<include file="Public:header" />
<link href="__PUBLIC__/css/litebox.css" rel="stylesheet" type="text/css">
<script src="__PUBLIC__/js/PCASClass.js" type="text/javascript"></script>
<!-- nice-scroll -->
<script src="__PUBLIC__/style/js/plugins/nice-scroll/jquery.nicescroll.min.js" type="text/javascript"></script>
<script type="text/javascript" src="__PUBLIC__/style/js/TableFreeze.js"></script>
<script src="__PUBLIC__/js/mxcrm_more.js" type="text/javascript"></script>

<style>
    body{
        overflow-y: hidden;
    }
    .option{padding-left:-30px;}
    #oDivL_tab_Test3{background-color: #fff;min-width: 300px;}
    #oTableLH_tab_Test3{min-width:300px;}
    .table{max-width: none;}
    .scene_active{background-color: #e6e9f0;}
    #tab_Test3 >tr {height:45px;line-height:45px;}
    .radio label::before{border:none;}
    .status_ico{
        position: absolute;
        top: -46px;
        background: #FFF;
        border: 1px solid #AAA;
        border-radius: 5px;
        padding: 7px;
        width: 220px;
        display: inline-block;
        display: none;
        left: 50%;
        margin-left: -159px;
        z-index: 101;
    }
    .status_ico:before {
        content: "";
        width: 0;
        height: 0;
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-top: 10px solid #AAA;
        position: absolute;
        bottom: -10px;
        left: 100px;
    }
    .status_ico:after{
        content: "";
        width: 0;
        height: 0;
        border-left: 9px solid transparent;
        border-right: 9px solid transparent;
        border-top: 9px solid #FFF;
        position: absolute;
        bottom: -9px;
        left: 101px;
    }

    #right-sidebar-log{
        width: 60% !important;
        right: -60%;
        background-color: #fff;
        position: fixed;
        top: 60px;
        z-index: 1009;
        bottom: 0;
        box-shadow: -5px -5px 1px #ccc;
    }
    .sidebar-container ul.nav-tabs li a{
        background: #fff !important;
        color: #a7b1c2 !important;
        font-weight: 600 !important;
        padding: 14px 20px 14px !important;
        border-right: none !important;
    }
    .sidebar-container nav{
        display: none;
    }
    .sidebar-container #page-wrapper{
        margin-left: 0px;
    }
    #sidebar-container{
        box-shadow: rgb(187, 187, 187) -1px 10px 10px;
        border: 2px solid rgb(238, 238, 238);
    }
    .LocalDataUIB{
        border: 1px solid rgb(216, 227, 239) !important;
    }
    .LocalDataUIB-input{
        border: none;
        height: 30px;
    }
    .LocalDataUIB i.placeholder{
        top: 3px;
    }
    .valueno .drop{
        display: none;
    }
    .valueno input,.valueno .close{
        display: none;
    }
    .valueno .LocalDataUIB{
        border: none !important;pointer-events: none;
    }
    .valueno{
        max-width: 200px;
    }
    .valueno .items{
        z-index: 0;
    }
</style>
<script>
    $(function () {
        $('#short_search').val() && $('.clearVal').css('display','inline-block');
        $('#short_search').on('input',ev=>{
            if(ev.target.value!=''){
                $('.clearVal').css('display','inline-block')
            }else{
                $('.clearVal').css('display','none')
            }
        })
        $('.clearVal').click(ev=>{
            $('#short_search').val('');
            $('.clearVal').css('display','none');
        })
        var scroll_width = 10;
        // var oTableLH_tab_Test3 = 38;
        $("#table_div").height(window.innerHeight - $("#table_div").offset().top - $("#tfoot_div").height() - parseInt($("#table_container").css("padding-bottom").replace("px", "")) - 10);
        $(window).resize(function () {
            $("#table_div").height(window.innerHeight - $("#table_div").offset().top - $("#tfoot_div").height() - parseInt($("#table_container").css("padding-bottom").replace("px", "")) - 10);
            $("#oDivL_tab_Test3").height($("#table_div").height() - scroll_width - 1).width($("#oTableLH_tab_Test3").width());
            $("#oDivH_tab_Test3").height($("#oTableLH_tab_Test3").height()).width($("#table_div").width() - scroll_width);
        })
        $(".nicescroll").niceScroll({
            cursorcolor: "#999", //#CC0071 光标颜色
            cursoropacitymax: 0.4, //改变不透明度非常光标处于活动状态（scrollabar“可见”状态），范围从1到0
            touchbehavior: false, //使光标拖动滚动像在台式电脑触摸设备
            cursorwidth: scroll_width + "px", //像素光标的宽度
            cursorborder: "0", //     游标边框css定义
            cursorborderradius: "3px", //以像素为光标边界半径
            autohidemode: false, //是否隐藏滚动条
            zindex: 100,
            background: "#F3F3F5", //滚动条背景色
        });
        if ("{$Think.get.by}") {
            $("#filter_ul").prev().html($("#filter_ul>li>a.active").text() + '<span class="fa fa-angle-down small_fa"></span>');
        }
        $("#tab_Test3").FrozenTable(1, 0, 4);
        $("#oDivL_tab_Test3").height($("#table_div").height() - scroll_width - 1).width($("#oTableLH_tab_Test3").width()).css({'zIndex': 9});
        $("#oDivL_tab_Test3").css({"background-color": "#fff", "border-right": "1px solid #e7eaec"});
        $("#oTableLH_tab_Test3").css({"border-right": "1px solid #e7eaec"});
        $("#oDivH_tab_Test3").height($("#oTableLH_tab_Test3").height()).width($("#table_div").width() - scroll_width).css({'zIndex': 9});
    })
</script>
<div class="wrapper wrapper-content">
    <include file="Public:alert" />
    <div class="row">
        <div class="col-md-12">
            <div class="ibox float-e-margins">
                <div class="title-bar" style="position: relative;z-index: 99;">
                    <div class="row  clearfix" id="title-hide" style="display:none;">
                        <ul class="breadcrum pull-left">
                            <li>已选中&nbsp;<span id="icheck_num"></span>&nbsp;项</li>
                            <if condition="$Think.get.content neq 'resource'">
                                <li class="single_btn"><a href="javascript:void(0)" id="log_customer"><i class="fa fa-file-text"></i>&nbsp;添加沟通日志</a></li>
                                <li class="single_btn business_btn"><a href="javascript:void(0)" id="remind"><i class="fa fa-bell-o"></i>&nbsp;提醒</a></li>
                            </if>
                            <if condition="$Think.get.content eq 'resource'">
                                <li><a id="batch_receive" href="javascript:void(0)"><i class="fa fa-reply"></i>&nbsp;领取</a></li>
                                <li><a id="batch_assign" href="javascript:void(0)"><i class="fa fa-share"></i>&nbsp;分配</a></li>
                                <else />
                                <if condition="$Think.get.by neq 'share'">
                                    <li><a id="remove" href="javascript:void(0)"><i class="fa fa-users"></i>&nbsp;放入客户公海</a></li>
                                </if>
                            </if>
                            <if condition="$Think.get.content neq 'resource'">
                                <if condition="$Think.get.by neq 'share' && checkPerByAction('customer','edit')">
                                    <li class="single_btn"><a href="javascript:void(0)" id="edit_customer"><i class="fa fa-pencil"></i>&nbsp;编辑</a></li>
                                </if>
                                <li class="single_btn business_btn"><a href="javascript:void(0)" id="to_top"><i class="fa fa-arrow-up"></i><span id="to_top_span">&nbsp;置顶</span></a></li>
                            </if>
                            <if condition="$Think.get.content neq 'resource' and $Think.get.by neq 'deleted' and $Think.get.by neq 'share'">
                                <if condition="checkPerByAction('customer','transfer_edit')">
                                    <li><a id="change" href="javascript:void(0)"><i class="fa fa-exchange"></i>&nbsp;转移</a></li>
                                </if>
                            </if>
                            <if condition="$Think.get.content neq 'resource' and $Think.get.by neq 'deleted' and $Think.get.by neq 'share'">
                                <if condition="checkPerByAction('customer','share')">
                                    <li><a id="share" href="javascript:void(0)"><i class="fa fa-share"></i>&nbsp;分享</a></li>
                                </if>
                            </if>
                            <if condition="$Think.get.by eq 'myshare'">
                                <if condition="checkPerByAction('customer','close_share')">
                                    <li><a id="close_share" href="javascript:void(0)"><i class="fa fa-mail-reply"></i>&nbsp;取消分享</a></li>
                                </if>
                            </if>
                            <if condition="$Think.get.by neq 'share'">
                                <if condition="checkPerByAction('customer','excelexport')">
                                    <li><a href="javascript:void(0);" class="link excelExport"><i class="fa fa-download"></i>&nbsp;导出</a></li>
                                </if>
                            </if>
                            <if condition = "$Think.get.by neq 'share'">
                                <if condition="(checkPerByAction('customer','delete') && $_GET['content'] neq 'resource') || (checkPerByAction('customer','del_resource') && $_GET['content'] eq 'resource') || session('?admin')">
                                    <li><a id="delete" href="javascript:void(0)"><i class="fa fa-times"></i>&nbsp;删除</a></li>
                                </if>
                            </if>
                            <li class="last_li"><big><a class="fa fa-times pull-right" id="back-show"></a></big></li>
                        </ul>
                    </div>
                    <div class="row " id="title-show">
                        <ul class="nav pull-left" style="margin:2px 0 0 15px;">
                            <a href="{:U('Customer/add')}" <if condition="$_GET['content']"> style="display:none"</if> class="btn btn-primary btn-sm pull-left" style="margin-right:8px"><i class="fa fa-plus-circle"></i>&nbsp; {:L('CREATE_NEW_CUSTOMER')}</a>
                        </ul>
                        <div class="pull-right" style="margin-right:20px;">
                            <form class="form-inline pull-left" id="customer_search" action="{:U('Customer/index')}" method="get">
                                <ul class="breadcrum pull-left" style="margin-bottom: 0px;padding-right:0px;">
                                    <if condition="$_GET['content'] != 'resource'">
                                        <li>
                                            <div class="input-group">
                                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" style="padding: 2px;">
                                                    <div class="input-group" style="margin-right: 10px;margin-bottom: 5px;color:#667B8F;">{$scene_name}<span class="caret"></span></div>
                                                </a>
                                                <ul class="dropdown-menu dropdown-alerts folder-list m-b-md" style="width:150px;">
                                                    <li class="list-group" role="presentation" id="event_group_1" style="height:160px;margin-bottom: 0px;">
                                                        <div class="full-height-scroll" id="scene_list" data-height="220px" data-plugin="slimScroll" style="overflow: hidden; width: auto;">
                                                            <volist name="scene_list" id="vo">
                                                                <if condition = "$vo['type'] eq 1">
                                                                    <a href="{:U('customer/index','by='.$vo['by'].'&'.$by_parameter)}" style="width:100%;color:#676a6c;padding:5px !important;float:left;" <if condition = "$_GET['by'] eq $vo['by']">class="scene_active"</if> title="{$vo['name']}">
                                                                        <else />
                                                                        <a href="{:U('customer/index','scene_id='.$vo['id'].'&'.$by_parameter)}" style="width:100%;color:#676a6c;padding:5px !important;float:left;" <if condition = "$_GET['scene_id'] eq $vo['id']">class="scene_active"</if> title="{$vo['name']}">
                                                                            </if>
                                                                            <div style="padding:0 10px;">
                                                                                <span class="pull-left" style="line-height:26px;">&nbsp;&nbsp;{$vo['cut_name']}</span>
                                                                            </div>
                                                                        </a>
                                                                        </volist>
                                                                        </div>
                                                                        </li>
                                                                        <!--<li style="float:left;width:100%;">-->
                                                                            <!--<a href="javascript:void(0);" id="add_scene" style="width:100%;color:#676a6c;padding:5px !important;float:left;">-->
                                                                                <!--<div style="padding:0 10px;">-->
                                                                                    <!--<span class="pull-left" style="line-height:26px;"><i class="fa fa-plus-circle"></i>&nbsp;新建场景</span>-->
                                                                                <!--</div>-->
                                                                            <!--</a>-->
                                                                        <!--</li>-->
                                                                        <li style="float:left;width:100%;">
                                                                            <a href="javascript:void(0);" id="setting_scene" style="width:100%;color:#676a6c;padding:5px !important;float:left;">
                                                                                <div style="padding:0 10px;">
                                                                                    <span class="pull-left" style="line-height:26px;"><i class="fa fa-cog"></i>&nbsp;管理</span>
                                                                                </div>
                                                                            </a>
                                                                        </li>
                                                                        </ul>
                                                                        </div>
                                                                        </li>
                                                                </if>
                                                                <li>
                                                                    搜索：
                                                                    <div class="input-group">
                                                                        <span class="fa fa-times-circle clearVal" style="margin: 10px -10px;position: relative;z-index: 5;display:none;cursor:pointer"></span>
                                                                        <input type="hidden" name="m" value="customer"/>
                                                                        <input type="hidden" name="a" value="index"/>
                                                                        <input type="hidden" name="field" value="name"/>
                                                                        <input type="hidden" name="condition" value="contains"/>
                                                                        <input type="hidden" name="content" value="{$_GET['content']}"/>
                                                                        <input type="hidden" name="by" value="{$_GET['by']}"/>
                                                                        <input type="hidden" name="scene_id" value="{$_GET['scene_id']}"/>

                                                                        <if condition="$_GET['field']">
                                                                            <!-- 导出相关 -->
                                                                            <input type="hidden" name="this_page" value="{$this_page}" />
                                                                            <input type="hidden" name="act" id="act" value="index"/>
                                                                            <input type="hidden" name="daochu" id="daochu"/>
                                                                            <input type="hidden" name="selectexcelxport" id="selectexcelxport"/>
                                                                            <input type="hidden" name="current_page" id="current_page" value=""/>
                                                                            <input type="hidden" name="export_limit" id="export_limit" value=""/>
                                                                            <!-- 导出相关 -->
                                                                        </if>

                                                                        <input id="short_search" type="text" style="width:180px;" placeholder="客户名/联系人/联系电话" onkeydown='if (event.keyCode == 13) {
                                                                                                            $("#short_search_btn").trigger("click");
                                                                                                            return false;
                                                                                                        }' class="form-control input-sm" name="search" <if condition = "$_GET['field'] eq 'name'">value="{$_GET['search']}"</if>/>
                                                                        <span class="input-group-btn">
                                                                            <button class="btn btn-default btn-search" id="short_search_btn" type="submit" style="height:32px;"><i class="fa fa-search"></i></button>
                                                                        </span>
                                                                    </div>
                                                                    &nbsp;&nbsp;<!--<a title="高级搜索" href="javascript:void(0)" id="search_type" class="btn btn-white btn-bitbucket"><i class="fa fa-filter" style="color: #D8E3EF;"></i></a>-->
                                                                </li>
                                                                </ul>
                                                                </form>
                                                                <div class="nav navbar-top-links navbar-left" style="margin-right:15px;">
                                                                    <div class="dropdown" style="">
                                                                        <a title="排序" href="javascript:void(0)" data-toggle="dropdown" class="btn btn-white btn-bitbucket dropdown-toggle" style="margin-left:-4px;"><i class="fa fa-sort-amount-asc" style="color: #D8E3EF;"></i></a>
                                                                        <ul class="dropdown-menu dropdown-menu-left" style="width:150px;left:-100px;" id='dropdown_order'>
                                                                            <li class="list-group" role="presentation" style="height:150px;" >
                                                                                <div class="full-height-scroll" data-height="150px" data-plugin="slimScroll" style="overflow: hidden; width: auto;margin-top:10px;" >
                                                                                    <div class="link-block" style="margin-left:15px;">
                                                                                        <div class="radio radio-info radio-inline">
                                                                                            <input type="radio" class="save_order" name="order_field" id="create_time_order" value="create_time" <if condition = "$_GET['order_field'] eq 'create_time'">checked</if> >
                                                                                            <label for="create_time_order">
                                                                                                创建时间
                                                                                            </label>
                                                                                        </div>
                                                                                    </div>
                                                                                    <div class="link-block" style="margin-left:15px;">
                                                                                        <div class="radio radio-info radio-inline">
                                                                                            <input type="radio" class="save_order" name="order_field" id="update_time_order" value="update_time" <if condition = "$_GET['order_field'] eq 'update_time' || $_GET['order_field'] eq ''">checked</if>>
                                                                                            <label for="update_time_order">
                                                                                                修改时间
                                                                                            </label>
                                                                                        </div>
                                                                                    </div>
                                                                                    <volist name="order_fields" id="vo">
                                                                                        <div class="link-block" style="margin-left:15px;">
                                                                                            <div class="radio radio-info radio-inline">
                                                                                                <input type="radio" class="save_order" name="order_field" id="{$vo['field']}_order" value="{$vo['field']}" <if condition = "$_GET['order_field'] eq $vo['field']">checked</if>>
                                                                                                <label for="{$vo['field']}_order">
                                                                                                    {$vo['name']}
                                                                                                </label>
                                                                                            </div>
                                                                                        </div>
                                                                                    </volist>
                                                                                </div>
                                                                            </li>
                                                                            <li class="divider" style="height:1px;"></li>
                                                                            <li>
                                                                                <div class="link-block" style="margin-left:15px;">
                                                                                    <div class="radio radio-info radio-inline">
                                                                                        <input type="radio" class="save_order" name="order_type" id="asc_order" value="asc" <if condition = "$_GET['order_type'] eq 'asc'">checked</if>>
                                                                                        <label for="asc_order">
                                                                                            正序
                                                                                        </label>
                                                                                    </div>
                                                                                </div>
                                                                                <div class="link-block" style="margin-left:15px;">
                                                                                    <div class="radio radio-info radio-inline">
                                                                                        <input type="radio" class="save_order" name="order_type" id="desc_order" value="desc" <if condition = "$_GET['order_type'] eq 'desc' || $_GET['order_type'] eq ''">checked</if>>
                                                                                        <label for="desc_order">
                                                                                            倒序
                                                                                        </label>
                                                                                    </div>
                                                                                </div>
                                                                                <div class="link-block" style="margin-left:15px;">
                                                                                    <div class="radio radio-info radio-inline">
                                                                                        <input type="radio" class="save_order" name="order_type" id="cancel_order" value="cancel_order" >
                                                                                        <label for="cancel_order">
                                                                                            取消排序
                                                                                        </label>
                                                                                    </div>
                                                                                </div>
                                                                            </li>
                                                                        </ul>
                                                                    </div>
                                                                </div>
                                                                <div class="btn-group pull-left">
                                                                    <!--<button data-toggle="dropdown" class="btn excelExport" aria-expanded="false">导出 <i class="fa fa-download"></i></button>-->
                                                                    <button data-toggle="dropdown" class="btn btn-primary dropdown-toggle" aria-expanded="false">操作 <span class="caret"></span>
                                                                    </button>
                                                                    <ul class="dropdown-menu">
                                                                        <if condition = "checkPerByAction('customer','excelimport')">
                                                                            <li style="display: none;"><a id="import_excel" class="link" href="javascript:void(0);"><i class="fa fa-upload"></i>&nbsp;导入</a></li>
                                                                        </if>
                                                                        <if condition = "checkPerByAction('customer','excelexport')">
                                                                            <li><a href="javascript:void(0);" class="link excelExport"><i class="fa fa-download"></i>&nbsp;导出</a></li>
                                                                        </if>
                                                                    </ul>
                                                                </div>
                                                        </div>
                                                        </div>
                                                        </div>
                                                        <div class="ibox-content clearfix" id="table_container" style="z-index: 1;">
                                                            <form id="form1" action="" method="post" style="position:relative;">
                                                                <input type="hidden" name="owner_role" id="hidden_owner_id" value="0"/>
                                                                <input type="hidden" name="message_alert" id="hidden_message" value="0"/>
                                                                <input type="hidden" name="sms_alert" id="hidden_sms" value="0"/>
                                                                <input type="hidden" name="email_alert" id="hidden_email" value="0"/>
                                                                <input type="hidden" name="operating_type" id="operating_type" value=""/>
                                                                <div id="table_div" class="nicescroll">
                                                                    <table class="table table-hover table-striped table_thead_fixed" id="tab_Test3">
                                                                        <if condition="$customerlist eq null">
                                                                            <div style="background-color:#fff;"><include file="Public:nodata" /></div>
                                                                            <else/>
                                                                            <tr id="childNodes_num" class="tabTh">
                                                                                <td style="width:30px;padding-left: 20px">
                                                                                    <div class="checkbox checkbox-primary">
                                                                                        <input type="checkbox" class="check_all"/>
                                                                                        <label for=""></label>
                                                                                    </div>
                                                                                </td>
                                                                            <if condition="$Think.get.content neq 'resource'">
                                                                                <td style="width: 26px;">&nbsp;</td>
                                                                            </if>
                                                                            <volist name="name_field_array" id="vo">
                                                                                <if condition = "$vo['field'] eq 'name'">
                                                                                    <td style="min-width:300px;">{$vo.name}</td>
                                                                                    <else />
                                                                                    <td >{$vo.name}</td>
                                                                                </if>
                                                                            </volist>
                                                                            <if condition="$Think.get.content neq 'resource'">
                                                                                <td style="width:30px;border-right:1px solid #e7eaec;"></td>
                                                                            </if>
                                                                            <if condition="$cn_is_show eq 1"><td>客户联系人</td></if>
                                                                            <!-- <if condition="$ct_is_show eq 1"><td>联系电话</td></if> -->

                                                                            <volist name="field_array" id="vo">
                                                                                <if condition="$vo['field'] neq 'name'">
                                                                                    <td>{$vo.name}</td>
                                                                                </if>
                                                                            </volist>
                                                                            <td>创建时间</td>
                                                                            <?php if($openrecycle == 2){ ?>
                                                                            <if condition="$_GET['asc_order'] == 'update_time' and $Think.get.content neq 'resource' ">
                                                                                <td><a href="{:U('customer/index','desc_order=update_time&'.$parameter)}" style="cursor: default;color:#000">{:L('FROM_THE_DUE_DAY')}&nbsp;<span class="fa fa-caret-up"></span></a></td>
                                                                                <elseif condition="$_GET['desc_order'] == 'update_time' and $Think.get.content neq 'resource' "/>
                                                                                <td><a href="{:U('customer/index','asc_order=update_time&'.$parameter)}" style="cursor: default;color:#000">{:L('FROM_THE_DUE_DAY')}&nbsp;<span class="fa fa-caret-down"></span></a></td>
                                                                                <elseif condition="$Think.get.content neq 'resource'"/>
                                                                                <td><a href="{:U('customer/index','desc_order=update_time&'.$parameter)}" style="cursor: default;color:#000">{:L('FROM_THE_DUE_DAY')}</a></td>
                                                                            </if>
                                                                            <?php } ?>
                                                                            <if condition="$Think.get.content neq 'resource'">
                                                                                <td colspan="2" style="min-width: 80px;">快捷操作</td>
                                                                            </if>
                                                                            </tr>
                                                                            <volist name="customerlist" id="vo">
                                                                                <tr class="controls_tr" rel="{$vo['customer_id']}">
                                                                                    <td style="width: 30px;padding-left: 20px;">
                                                                                        <div class="checkbox checkbox-primary">
                                                                                            <input name="customer_id[]" class="check_list" type="checkbox" value="{$vo.customer_id}" rel="{$vo['business_id']}" rel1="{$vo['set_top']}" rel2="{$vo['remind_time']}" />
                                                                                            <label></label>
                                                                                        </div>
                                                                                    </td>
                                                                                <if condition="$Think.get.content neq 'resource'">
                                                                                    <td>
                                                                                        <a href="javascript:void(0);" class="remind_view" rel="{$vo['customer_id']}">
                                                                                            <span class="fa fa-bell-o {$vo['remind_time'] > time() ? '':'hide'}" id="remind_view_{$vo['customer_id']}" style="font-size:16px;color:orange"></span>
                                                                                        </a>
                                                                                    </td>
                                                                                </if>
                                                                                <volist name="name_field_array" id="v">
                                                                                    <td style="min-width:100px;">
                                                                                    <if condition="$Think.get.content neq 'resource'">
                                                                                        <if condition ="$vo['set_top'] eq 1">
                                                                                            <a class="" href="{:U('customer/view', 'id='.$vo['customer_id'])}" title="{$vo['custome_title_name']}" target="_blank" rel="{$vo['customer_id']}" style="border-left: 5px solid #ffb07b;padding-left: 5px;line-height: 24px;" >
                                                                                                <else />
                                                                                                <a class="" href="{:U('customer/view', 'id='.$vo['customer_id'])}" title="{$vo['custome_title_name']}" target="_blank" rel="{$vo['customer_id']}" style="padding-left: 5px;line-height: 24px;" >
                                                                                                    </if>
                                                                                                    <else/>
                                                                                                    <a class="" href="{:U('customer/view', 'content=resource&id='.$vo['customer_id'])}" title="{$vo['custome_title_name']}" rel="{$vo['customer_id']}"target="_blank">
                                                                                                        </if>
                                                                                                        {$vo['name']}
                                                                                                    </a>
                                                                                                    </td>
                                                                                                    </volist>
                                                                                                    <if condition="$Think.get.content neq 'resource'">
                                                                                                        <td style="width:30px;border-right:1px solid #e7eaec;">
                                                                                                            <a class="log_customer" href="javascript:void(0);" rel="{$vo['customer_id']}">
                                                                                                                <i class="fa fa-toggle-right" id="fa_log_{$vo['customer_id']}" title="沟通日志" style="float:right;color:#ccc;"></i>
                                                                                                            </a>
                                                                                                        </td>
                                                                                                    </if>
                                                                                                    <if condition="$cn_is_show eq 1">
                                                                                                        <td>
                                                                                                            <a href="{:U('contacts/view','id='.$vo['contacts_id'])}">{$vo['contacts_name']}</a>
                                                                                                            <if condition='$vo["contacts_name"]'>
                                                                                                            <a class="dropdown-toggle count-info call_out" id="phone_url" rel="{$vo['contacts_id']}" data-toggle="dropdown" href="#" title="呼叫">
                                                                                                                    <span class="glyphicon glyphicon-earphone" id="phone_num"></span>
                                                                                                                </a>
                                                                                                            </if>
                                                                                                        </td>
                                                                                                    </if>
                                                                                                    <!-- <if condition="$ct_is_show eq 1"><td>{$vo['contacts_telephone']}<if condition="$vo.contacts_telephone neq ''"><a class="dropdown-toggle count-info call_out" id="phone_url" rel="{$vo['contacts_telephone']}" data-toggle="dropdown" href="#" title="呼叫">
                                                                                                        <span class="glyphicon glyphicon-earphone" id="phone_num"></span>
                                                                                                    </a></if></td></if> -->

                                                                                                    <volist name="field_array" id="v">
                                                                                                        <if condition="$v['field'] neq 'name'">
                                                                                                            <td style="position: relative;">
                                                                                                                <span style="color:#{$v['color']}">
                                                                                                                    <if condition="$v['form_type'] eq 'datetime'">
                                                                                                                        <if condition="$vo[$v['field']]">
                                                                                                                            {$vo[$v['field']]|date='Y-m-d H:i',###}
                                                                                                                        </if>
                                                                                                                        <elseif  condition = "$v['field'] eq 'customer_status'" />
                                                                                                                        <!--<span class="label label-success editstatus">{$vo['customer_status']}</span>-->
                                                                                                                        <if condition = "$vo['customer_status'] eq '重点客户'">
                                                                                                                            <span class="label label-success editstatus">重点客户</span>
                                                                                                                            <elseif  condition =  "$vo['customer_status'] eq '试单客户'"/>
                                                                                                                            <span class="label label-danger editstatus">试单客户</span>
                                                                                                                            <elseif  condition =  "$vo['customer_status'] eq '准备签约'"/>
                                                                                                                            <span class="label editstatus">准备签约</span>
                                                                                                                            <elseif  condition =  "$vo['customer_status'] eq '电话沟通'"/>
                                                                                                                            <span class="label label-purple editstatus">电话沟通</span>
                                                                                                                            <elseif  condition =  "$vo['customer_status'] eq '准备拜访'"/>
                                                                                                                            <span class="label css-Interview editstatus">准备拜访</span>
                                                                                                                            <elseif  condition =  "$vo['customer_status'] eq '无意向'"/>
                                                                                                                            <span class="label label-primary editstatus">无意向</span>
                                                                                                                            <elseif  condition =  "$vo['customer_status'] eq '黑名单'"/>
                                                                                                                            <span class="label label-black editstatus">黑名单</span>
                                                                                                                            <elseif  condition =  "$vo['customer_status'] eq '无状态'"/>
                                                                                                                            <span class="label label-warning editstatus">无状态</span>
                                                                                                                            <else />
                                                                                                                            <span class="label label-primary editstatus">编辑</span>
                                                                                                                        </if>

                                                                                                                        <div class="status_ico form-inline editable-wrap editable-select" role="form" blur="cancel">
                                                                                                                            <div class="editable-controls form-group">
                                                                                                                                <select class="form-control" style="vertical-align: baseline;height: 34px;">
                                                                                                                                    <option value="重点客户" label="重点客户">重点客户</option>
                                                                                                                                    <option value="试单客户" label="试单客户">试单客户</option>
                                                                                                                                    <option value="准备签约" label="准备签约">准备签约</option>
                                                                                                                                    <option value="电话沟通" label="电话沟通">电话沟通</option>
                                                                                                                                    <option value="准备拜访" label="准备拜访">准备拜访</option>
                                                                                                                                    <option value="无意向" label="无意向">无意向</option>
                                                                                                                                    <option value="黑名单" label="黑名单">黑名单</option>
                                                                                                                                    <option value="无状态" label="无状态">无状态</option>
                                                                                                                                </select>
                                                                                                                                <span class="editable-buttons">
                                                                                                                                    <button type="button" class="btn btn-primary status_btnedit">
                                                                                                                                        <span class="glyphicon glyphicon-ok"></span>
                                                                                                                                    </button>
                                                                                                                                    <button type="button" class="btn btn-default">
                                                                                                                                        <span class="glyphicon glyphicon-remove"></span>
                                                                                                                                    </button>
                                                                                                                                </span>
                                                                                                                            </div>
                                                                                                                        </div>
                                                                                                                        <elseif  condition = "$v['field'] eq 'grade'" />
                                                                                                                        <p class="form-p1">
                                                                                                                            <!-- 星星 -->
                                                                                                                            <?php $start = $vo['grade']+1; $end = 6-$vo['grade']; ?>
                                                                                                                            <span style="cursor:pointer;color:#D0D0D0;">
                                                                                                                                <for start="1" end="$start">
                                                                                                                                    <i class="fa fa-star star-orange"></i>&nbsp;
                                                                                                                                </for><for start="1" end="$end">
                                                                                                                                    <i class="fa fa-star"></i>&nbsp;
                                                                                                                                </for>
                                                                                                                            </span>
                                                                                                                            <!--<a href="javascript:void(0);" class="fa fa-pencil pencil-size field-edit hide"></a>-->
                                                                                                                        </p>
                                                                                                                        <elseif  condition = "$v['field'] eq 'industry'" />
                                                                                                                        <div  class="form-group valueno">
                                                                                                                            <div class="col-md-7" style="padding-left: 0;">
                                                                                                                                <input data-selector="industrys" value="{$vo[$v['field']]}" type="text"  readonly/>
                                                                                                                            </div>
                                                                                                                        </div>
                                                                                                                        <elseif  condition = "$v['field'] eq 'address'" />
                                                                                                                        <div  class="form-group valueno">
                                                                                                                            <div class="col-md-7" style="padding-left: 0;">
                                                                                                                                <input data-selector="wantdqs" value="{$vo[$v['field']]}" type="text" >
                                                                                                                            </div>
                                                                                                                        </div>
                                                                                                                        <else />
                                                                                                                        {$vo[$v['field']]}

                                                                                                                    </if>
                                                                                                                </span>
                                                                                                            </td>
                                                                                                        </if>
                                                                                                    </volist>
                                                                                                    <td>{$vo['update_time']|date='Y-m-d',###}</td>
                                                                                                    <if condition="$Think.get.content neq 'resource'">
                                                                                                        <if condition="$openrecycle eq 2">
                                                                                                            <td>
                                                                                                                <?php if(checkPerByAction('customer','customerlock')){ ?>
                                                                                                                <a style="margin-left:0px;" href="{:U('customer/customerlock','customer_id='.$vo['customer_id'])}">
                                                                                                                    <if condition="$vo['is_locked']">
                                                                                                                        <img style="width:19px;" title="{:L('UNLOCK_TITLE')}" src="__PUBLIC__/img/locking.png"/>
                                                                                                                        <else/>
                                                                                                                        <img title="{:L('LOCK_TITLE')}" style="width:19px;" src="__PUBLIC__/img/unlocking.png"/>
                                                                                                                    </if>
                                                                                                                </a>
                                                                                                                <?php } ?>
                                                                                                            <if condition="!$vo['is_locked']">
                                                                                                                <font color="#7486A8" title="{$vo['days']}天未跟进或{$vo['c_days']}天未签合同，将自动回归客户公海">{$vo['days']}/{$vo['c_days']}</font>
                                                                                                                <else/>
                                                                                                                <font color="#7486A8">已锁定</font>
                                                                                                            </if>
                                                                                                            </td>
                                                                                                        </if>
                                                                                                        <td class="detail-right" style="width:30px;">
                                                                                                            <!--<a data-toggle="tooltip" data-placement="top" <if condition ="$vo['set_top'] eq 1"> data-original-title="取消置顶" <else />data-original-title="置顶" </if> href="{:U('customer/settop','module=customer&module_id='.$vo['customer_id'])}">-->
                                                                                                                <!--<i class="fa fa-x fa-thumb-tack" style="font-size:16px;"></i>-->
                                                                                                            <!--</a>-->
                                                                                                        </td>
                                                                                                        <td class="detail-right" style="width:30px;">
                                                                                                            <!--<a data-toggle="tooltip" data-placement="top" class="addproduct" data-original-title="添加项目" rel="{$vo['customer_id']}" href="/index.php?m=business&a=add">-->
                                                                                                            <!--<i class="fa fa-cube" style="font-size:16px;"></i>-->
                                                                                                            <!--</a>-->
                                                                                                            <a data-toggle="tooltip" data-placement="top" data-original-title="添加项目" rel="{$vo['customer_id']}" href="/index.php?m=business&a=add&customer_id={$vo['customer_id']}">
                                                                                                                <i class="fa fa-cube" style="font-size:16px;"></i>
                                                                                                            </a>
                                                                                                        </td>
                                                                                                    </if>
                                                                                                    </tr>
                                                                                                    </volist>
                                                                                                    </if>
                                                                                                    </table>
                                                                                                    </div>
                                                                                                    <div id="tfoot_div" class="clearfix">
                                                                                                        <div class="clearfix" id="tfoot_page">
                                                                                                            <if condition="$fields_search || $_GET['field']">
                                                                                                                <span class="pull-left" style="margin-left:25px;margin-top:10px;">本次搜索结果<span style="color:#F8AC59"> {$count} </span>条数据<a href="{:U('customer/index')}" class="btn" style="background:#fff;border:1px solid #ccc;margin-left:10px;color:#999;" id="clearnumber">清除搜索条件</a></span>
                                                                                                            </if>
                                                                                                            {$page}<include file="Public:listrows" />
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    </form>
                                                                                                    </div>
                                                                                                    </div>
                                                                                                    </div>
                                                                                                    </div>
                                                                                                    </div>
                                                                                                    <div style="display:none" id="dialog-import" title="{:L('IMPORT_DATE')}">
                                                                                                        <div class="spiner-example">
                                                                                                            <div class="sk-spinner sk-spinner-three-bounce">
                                                                                                                <div class="sk-bounce1"></div>
                                                                                                                <div class="sk-bounce2"></div>
                                                                                                                <div class="sk-bounce3"></div>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    <div style="display:none" id="dialog-role-info" title="{:L('EMPLOYEE_INFORMATION')}">
                                                                                                        <div class="spiner-example">
                                                                                                            <div class="sk-spinner sk-spinner-three-bounce">
                                                                                                                <div class="sk-bounce1"></div>
                                                                                                                <div class="sk-bounce2"></div>
                                                                                                                <div class="sk-bounce3"></div>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    <div style="display:none" id="dialog-fenpei" title="{:L('DISTRIBUTION_OF_CUSTOMERS')}">
                                                                                                        <div class="spiner-example">
                                                                                                            <div class="sk-spinner sk-spinner-three-bounce">
                                                                                                                <div class="sk-bounce1"></div>
                                                                                                                <div class="sk-bounce2"></div>
                                                                                                                <div class="sk-bounce3"></div>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    <div style="display:none" id="dialog-assign" title="{:L('DISTRIBUTION_OF_CUSTOMERS')}">
                                                                                                        <div class="spiner-example">
                                                                                                            <div class="sk-spinner sk-spinner-three-bounce">
                                                                                                                <div class="sk-bounce1"></div>
                                                                                                                <div class="sk-bounce2"></div>
                                                                                                                <div class="sk-bounce3"></div>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    <div style="display:none" id="dialog-log" title="添加跟进记录">
                                                                                                        <div class="spiner-example">
                                                                                                            <div class="sk-spinner sk-spinner-three-bounce">
                                                                                                                <div class="sk-bounce1"></div>
                                                                                                                <div class="sk-bounce2"></div>
                                                                                                                <div class="sk-bounce3"></div>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    <div style="display:none" id="dialog-remind" title="提醒">
                                                                                                        <div class="spiner-example">
                                                                                                            <div class="sk-spinner sk-spinner-three-bounce">
                                                                                                                <div class="sk-bounce1"></div>
                                                                                                                <div class="sk-bounce2"></div>
                                                                                                                <div class="sk-bounce3"></div>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    <div style="display:none" id="dialog-remind_view" title="提醒内容">
                                                                                                        <div class="spiner-example">
                                                                                                            <div class="sk-spinner sk-spinner-three-bounce">
                                                                                                                <div class="sk-bounce1"></div>
                                                                                                                <div class="sk-bounce2"></div>
                                                                                                                <div class="sk-bounce3"></div>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    <div style="display:none" id="dialog-advance" title="阶段变更">
                                                                                                        <div class="spiner-example">
                                                                                                            <div class="sk-spinner sk-spinner-three-bounce">
                                                                                                                <div class="sk-bounce1"></div>
                                                                                                                <div class="sk-bounce2"></div>
                                                                                                                <div class="sk-bounce3"></div>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    <div style="display:none;" id="dialog-map" title="{:L('MAP')}">
                                                                                                        <div class="spiner-example">
                                                                                                            <div class="sk-spinner sk-spinner-three-bounce">
                                                                                                                <div class="sk-bounce1"></div>
                                                                                                                <div class="sk-bounce2"></div>
                                                                                                                <div class="sk-bounce3"></div>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    <div style="display:none" id="dialog-transform" title="客户转移">
                                                                                                        <div class="spiner-example">
                                                                                                            <div class="sk-spinner sk-spinner-three-bounce">
                                                                                                                <div class="sk-bounce1"></div>
                                                                                                                <div class="sk-bounce2"></div>
                                                                                                                <div class="sk-bounce3"></div>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    <include file="Public:mapbaidu" />

                                                                                                    <div style="display:none" id="dialog-field-search" title="高级搜索">
                                                                                                        <form class="form-inline" id="searchForm" action="{:U('customer/index')}" method="get">
                                                                                                            <div id="search_add" style="width:650px;float:left;">
                                                                                                                <input type="hidden" name="scene_id" value="{$_GET['scene_id']}"/>
                                                                                                                <if condition="$_GET['field'] eq ''">
                                                                                                                    <input type="hidden" name="content" <if condition="$_GET['content']">value="resource"</if> />
                                                                                                                    <input type="hidden" name="this_page" value="{$this_page}" />

                                                                                                                    <input type="hidden" name="m" value="customer"/>
                                                                                                                    <input type="hidden" name="act" id="act" value="index"/>
                                                                                                                    <input type="hidden" name="daochu" id="daochu"/>
                                                                                                                    <input type="hidden" name="selectexcelxport" id="selectexcelxport"/>
                                                                                                                    <input type="hidden" name="current_page" id="current_page" value=""/>
                                                                                                                    <input type="hidden" name="export_limit" id="export_limit" value=""/>
                                                                                                                    <if condition="$Think.get.by neq null">
                                                                                                                        <input type="hidden" name="by" value="{$Think.get.by}"/>
                                                                                                                    </if>
                                                                                                                </if>
                                                                                                                <empty name="fields_search">
                                                                                                                    <div id="con_search_1" style="float:left;width:650px;margin:0 10px 0 10px;">
                                                                                                                        <ul class="nav pull-left" style="margin:0px 0 0 23px;width:650px;">
                                                                                                                            <li class="pull-left">
                                                                                                                                <select id="field_1" style="width:auto" class="form-control input-sm field_name new-select" onchange="changeCondition(1)" >
                                                                                                                                    <option class="" value="name">--{:L('PLEASE_SELECT_A_FILTER_CONDITION')}--</option>
                                                                                                                                    <volist name="field_list" id="v">
                                                                                                                                        <if condition="$v['field'] neq 'customer_owner_id'">
                                                                                                                                            <if  condition="$v[name] neq '所在城市' && $v[name] neq '所属行业'">
                                                                                                                                                <option class="{$v['form_type']}" value="{$v[field]}" rel="customer" <if condition = "$_GET['field'] eq '' && $v['field'] eq 'name'">selected="selected"</if>>{$v[name]}</option>
                                                                                                                                            </if>
                                                                                                                                        </if>
                                                                                                                                    </volist>
                                                                                                                                    <if condition="$Think.get.content eq 'resource1'">
                                                                                                                                        <option class="role" value="owner_role_id">{:L('PRINCIPAL')}</option>
                                                                                                                                    </if>
                                                                                                                                    <option class="date" value="create_time">{:L('CREATION_TIME')}</option>
                                                                                                                                    <option class="date" value="update_time">{:L('MODIFICATION_TIME')}</option>
                                                                                                                                    <option class="text" value="contacts_name">首要联系人姓名</option>
                                                                                                                                    <option class="mobile" value="contacts_telephone">首要联系人电话</option>
                                                                                                                                    <!-- <option class="business_status" value="status_id">客户进度</option> -->
                                                                                                                                </select>&nbsp;&nbsp;
                                                                                                                            </li>
                                                                                                                            <li class="pull-left" id="conditionContent_1">
                                                                                                                                <select id="condition_1" style="width:auto" class="form-control input-sm new-select" onchange="changeSearch()" name="name[condition]">
                                                                                                                                    <option value="contains">{:L('INCLUDE')}</option>
                                                                                                                                    <option value="not_contain">{:L('EXCLUSIVE')}</option>
                                                                                                                                    <option value="is">{:L('YES')}</option>
                                                                                                                                    <option value="isnot">{:L('ISNOT')}</option>
                                                                                                                                    <option value="start_with">{:L('BEGINNING_CHARACTER')}</option>
                                                                                                                                    <option value="end_with">{:L('TERMINATION_CHARACTER')}</option>
                                                                                                                                    <option value="is_empty">{:L('MANDATORY')}</option>
                                                                                                                                    <option value="is_not_empty">{:L('ISNOTEMPTY')}</option>
                                                                                                                                </select>&nbsp;&nbsp;
                                                                                                                            </li>
                                                                                                                            <li class="pull-left" id="searchContent_1">
                                                                                                                                <input id="search_1" type="text" style="width:160px;" class="input-medium form-control input-sm search-query" name="name[value]"/>&nbsp;&nbsp;
                                                                                                                            </li>
                                                                                                                        </ul>
                                                                                                                    </div>
                                                                                                                    <?php $max_key = 1;?>
                                                                                                                    <else />
                                                                                                                    <volist name="fields_search" key="key1" id="vo">
                                                                                                                        <div id="con_search_{$key1}" style="float:left;width:650px;margin:10px 10px 0 10px;">
                                                                                                                            <div  id="rem_{$key1}" class="pull-left" style="line-height:30px;"><a href="javascript:void(0);" class="rem_search" rel="{$key1}" title="移除"><span class="fa fa-times-circle"></span></a></div>&nbsp;
                                                                                                                            <ul class="nav pull-left" style="margin:0px 0 0 5px;width:620px;">
                                                                                                                                <li class="pull-left">
                                                                                                                                    <select id="field_{$key1}" style="width:160px" class="form-control input-sm field_name" onchange="changeCondition({$key1})" >
                                                                                                                                        <option class="" value="name">--{:L('PLEASE_SELECT_A_FILTER_CONDITION')}--</option>
                                                                                                                                        <volist name="field_list" id="v">
                                                                                                                                            <if condition="$v['field'] neq 'customer_owner_id'">
                                                                                                                                                <if  condition="$v[name] neq '所在城市' && $v[name] neq '所属行业'">
                                                                                                                                                    <option class="{$v['form_type']}" value="{$v[field]}" rel="customer" <if condition = "$_GET['field'] eq '' && $v['field'] eq 'name'">selected="selected"</if>>{$v[name]}</option>
                                                                                                                                                </if>
                                                                                                                                                </option>
                                                                                                                                            </if>
                                                                                                                                        </volist>
                                                                                                                                        <if condition="$_GET['content'] neq 'resource'">
                                                                                                                                            <option class="role" value="owner_role_id" <if condition = "$vo['field'] eq 'owner_role_id'">selected="selected"</if>>{:L('PRINCIPAL')}</option>
                                                                                                                                        </if>
                                                                                                                                        <option class="date" value="create_time" <if condition = "$vo['field'] eq 'create_time'">selected="selected"</if>>{:L('CREATION_TIME')}</option>
                                                                                                                                        <option class="date" value="update_time" <if condition = "$vo['field'] eq 'update_time'">selected="selected"</if>>{:L('MODIFICATION_TIME')}</option>
                                                                                                                                        <option class="text" value="contacts_name" <if condition = "$vo['field'] eq 'contacts_name'">selected="selected"</if>>首要联系人姓名</option>
                                                                                                                                        <option class="mobile" value="contacts_telephone" <if condition = "$vo['field'] eq 'contacts_telephone'">selected="selected"</if>>首要联系人电话</option>
                                                                                                                                    </select>&nbsp;&nbsp;
                                                                                                                                </li>
                                                                                                                                <li class="pull-left" id="conditionContent_{$key1}">
                                                                                                                                <if condition="$vo.form_type eq 'number'">
                                                                                                                                    <select style="width:100px;" class="form-control input-sm" name="{$vo['field']}[condition]">
                                                                                                                                        <option value="gt" <if condition="$fields_search[$vo['field']][condition] eq 'gt'">selected="selected"</if>>{:L('GT')}</option>
                                                                                                                                        <option value="lt" <if condition="$fields_search[$vo['field']][condition] eq 'lt'">selected="selected"</if>>{:L('LT')}</option>
                                                                                                                                        <option value="eq" <if condition="$fields_search[$vo['field']][condition] eq 'eq'">selected="selected"</if>>{:L('EQ')}</option>
                                                                                                                                        <option value="neq" <if condition="$fields_search[$vo['field']][condition] eq 'neq'">selected="selected"</if>>{:L('NEQ')}</option>
                                                                                                                                    </select>
                                                                                                                                    <elseif condition="$vo.field eq 'owner_role_id' || $vo.field eq 'status_id' || $vo.form_type eq 'datetime'"/>
                                                                                                                                    <elseif condition="$vo.form_type eq 'box'" />
                                                                                                                                    <span id="{$vo['field']}">{$vo.value}</span>
                                                                                                                                    <script type="text/javascript">
                                                                                                                                        var b = '{$vo[field]}';
                                                                                                                                        var c = 'customer';
                                                                                                                                        var value_str = $("#{$vo['field']}").html();
                                                                                                                                        $.ajax({
                                                                                                                                            type: 'get',
                                                                                                                                            url: 'index.php?m=setting&a=boxfield&model=' + c + '&field=' + b,
                                                                                                                                            async: false,
                                                                                                                                            success: function (data) {
                                                                                                                                                options = '';
                                                                                                                                                $.each(data.data, function (k, v) {
                                                                                                                                                    if (value_str == v) {
                                                                                                                                                        select = 'selected';
                                                                                                                                                    } else {
                                                                                                                                                        select = '';
                                                                                                                                                    }
                                                                                                                                                    options += "<option value='" + v + "' " + select + ">" + v + "</option>";
                                                                                                                                                });
                                                                                                                                                $("#{$vo['field']}").html('<select class="{$vo["field"]} form-control input-sm" style="width:auto" name="{$vo["field"]}[value]" ><option value="">--请选择--</option>' + options + '</select>&nbsp;&nbsp;');
                                                                                                                                            },
                                                                                                                                            dataType: 'json'
                                                                                                                                        });
                                                                                                                                    </script>
                                                                                                                                    <elseif condition="$vo.form_type eq 'address'" />
                                                                                                                                    <select style="width:auto;margin-top: 13px;" class="form-control input-sm" name="{$vo['field']}[condition]">
                                                                                                                                        <option value="contains" <if condition="$fields_search[$vo['field']][condition] eq 'contains'">selected="selected"</if>>{:L('IN')}</option>
                                                                                                                                        <option value="not_contain" <if condition="$fields_search[$vo['field']][condition] eq 'not_contain'">selected="selected"</if>>{:L('NOTIN')}</option>
                                                                                                                                    </select>
                                                                                                                                    <select name="{$vo['field']}[state]" class="form-control input-sm" id="state" style="width:135px;margin-top: 13px;"></select>
                                                                                                                                    <!--<select name="{$vo['field']}[city]" class="form-control input-sm" id="city" style="width:110px;margin-top: 13px;"></select>-->
                                                                                                                                    <!--<select name="{$vo['field']}[area]" class="form-control input-sm" id="area" style="width:110px;margin-top: 13px;"></select>-->
                                                                                                                                    <input type="text" id="search" name="{$vo['field']}[value]" value="{$fields_search[$vo['field']][value]}" class="form-control input-sm" style="margin-top: 13px;" placeholder="{:L('THE_STREET_INFORMATION')}" class="input-large">
                                                                                                                                    <script type="text/javascript">
                                                                                                                                        new PCAS("{$vo['field']}[state]", "{$vo['field']}[city]", "{$vo['field']}[area]", "<php>echo $fields_search[$vo['field']]['state'];</php>", "<php>echo $fields_search[$vo['field']]['city'];</php>", "<php>echo $fields_search[$vo['field']]['area'];</php>");
                                                                                                                                    </script>
                                                                                                                                    <else />
                                                                                                                                    <select style="width:auto" class="form-control input-sm" name="{$vo['field']}[condition]">
                                                                                                                                        <option value="contains" <if condition="$fields_search[$vo['field']][condition] eq 'contains'">selected="selected"</if>>{:L('INCLUDE')}</option>
                                                                                                                                        <option value="not_contain" <if condition="$fields_search[$vo['field']][condition] eq 'not_contain'">selected="selected"</if>>{:L('EXCLUSIVE')}</option>
                                                                                                                                        <option value="is" <if condition="$fields_search[$vo['field']][condition] eq 'is'">selected="selected"</if>>{:L('YES')}</option>
                                                                                                                                        <option value="isnot" <if condition="$fields_search[$vo['field']][condition] eq 'isnot'">selected="selected"</if>>{:L('NO')}</option>
                                                                                                                                        <option value="start_with" <if condition="$fields_search[$vo['field']][condition] eq 'start_with'">selected="selected"</if>>{:L('BEGINNING_CHARACTER')}</option>
                                                                                                                                        <option value="end_with" <if condition="$fields_search[$vo['field']][condition] eq 'end_with'">selected="selected"</if>>{:L('TERMINATION_CHARACTER')}</option>
                                                                                                                                        <option value="is_empty" <if condition="$fields_search[$vo['field']][condition] eq 'is_empty'">selected="selected"</if>>{:L('MANDATORY')}</option>
                                                                                                                                        <option value="is_not_empty" <if condition="$fields_search[$vo['field']][condition] eq 'is_not_empty'">selected="selected"</if>>{:L('ISNOTEMPTY')}</option>
                                                                                                                                    </select>
                                                                                                                                </if>
                                                                                                                                </li>
                                                                                                                                <li class="pull-left" id="searchContent_{$key1}" style="margin-left:5px;">
                                                                                                                                <if condition="$vo['form_type'] neq 'box' && $vo['form_type'] neq 'address'">
                                                                                                                                    <if condition="$vo['form_type'] eq 'datetime'">
                                                                                                                                        <input id="start_{$vo['field']}" type="text" class="form-control input-sm search-query" name="{$vo['field']}[start]" onclick="WdatePicker()" value="{$fields_search[$vo['field']][start]}" rel="customer"/> 至 <input id="end_{$vo['field']}" type="text" class="form-control input-sm search-query" name="{$vo['field']}[end]" onclick="WdatePicker()" value="{$fields_search[$vo['field']][end]}" rel="customer"/>
                                                                                                                                        <elseif condition="$vo['field'] eq 'owner_role_id'"/>
                                                                                                                                        <span id="owner_role_search" rel="{$key1}" rel1="{$vo['field']}[value]" rel2="{$fields_search[$vo['field']][value]}"/>
                                                                                                                                        <script type="text/javascript">
                                                                                                                                            var key_id = $('#owner_role_search').attr('rel');
                                                                                                                                            var search_owner_role_id = $('#owner_role_search').attr('rel1');
                                                                                                                                            var owner_roleid = $('#owner_role_search').attr('rel2');
                                                                                                                                            $.ajax({
                                                                                                                                                type: 'get',
                                                                                                                                                url: 'index.php?m=user&a=getrolelist&module=customer&action=index',
                                                                                                                                                async: false,
                                                                                                                                                success: function (data) {
                                                                                                                                                    options = '';
                                                                                                                                                    $.each(data.data, function (k, v) {
                                                                                                                                                        options += '<option value="' + v.role_id + '" checkedit>' + v.user_name + ' [' + v.department_name + '-' + v.role_name + '] </option>';
                                                                                                                                                    });
                                                                                                                                                    $("#searchContent_" + key_id + "").html('<select class="selectpicker show-tick form-control input-sm" data-live-search="true" id="search_' + key_id + '" name="' + search_owner_role_id + '" style="width:auto">' + options + '</select>');
                                                                                                                                                    var owner_roleid = "{$fields_search[$vo['field']][value]}";
                                                                                                                                                    $('#search_' + key_id + ' option[value=' + owner_roleid + ']').prop('selected', true);
                                                                                                                                                },
                                                                                                                                                dataType: 'json'
                                                                                                                                            });
                                                                                                                                        </script>
                                                                                                                                        <elseif condition="$vo['field'] eq 'status_id'"/>
                                                                                                                                        <span id="bus_status_id" rel="{$key1}" rel1="{$vo['field']}[value]" rel2="{$fields_search[$vo['field']][value]}"/>
                                                                                                                                        <script type="text/javascript">
                                                                                                                                            $()
                                                                                                                                            var key_id = $('#bus_status_id').attr('rel');
                                                                                                                                            var search = $('#bus_status_id').attr('rel1');
                                                                                                                                            var search_roleid = $('#bus_status_id').attr('rel2');
                                                                                                                                            $.ajax({
                                                                                                                                                type: 'get',
                                                                                                                                                url: 'index.php?m=setting&a=getbusinessstatuslist',
                                                                                                                                                async: false,
                                                                                                                                                success: function (data) {
                                                                                                                                                    options = '';
                                                                                                                                                    $.each(data.data, function (k, v) {
                                                                                                                                                        select = '';
                                                                                                                                                        if (v.status_id == search_roleid) {
                                                                                                                                                            select = 'selected';
                                                                                                                                                        }
                                                                                                                                                        options += '<option value="' + v.status_id + '" ' + select + '>' + v.name + '</option>';
                                                                                                                                                    });

                                                                                                                                                    $("#searchContent_" + key_id + "").html('<select class="form-control input-sm" id="search_' + key_id + '" style="width:auto" name="' + search + '">' + options + '</select>');
                                                                                                                                                    var owner_roleid = "{$fields_search[$vo['field']][value]}";
                                                                                                                                                    $('#search_' + key_id + ' option[value=' + owner_roleid + ']').prop('selected', true);
                                                                                                                                                },
                                                                                                                                                dataType: 'json'
                                                                                                                                            });
                                                                                                                                        </script>
                                                                                                                                        <else/>
                                                                                                                                        <input name="{$vo['field']}[value]" type="text" class="form-control input-sm search-query" class="{$vo['form_type']}" value="{$fields_search[$vo['field']][value]}" rel="customer">
                                                                                                                                    </if>
                                                                                                                                </if>
                                                                                                                                </li>
                                                                                                                            </ul>
                                                                                                                        </div>
                                                                                                                        <?php $max_key = $key1;?>
                                                                                                                    </volist>

                                                                                                                </empty>
                                                                                                            </div>
                                                                                                            <div class="clearfix"></div>
                                                                                                            <!--<div style="margin-left: 35px;margin-top:10px;"><a href="javascript:void(0);" style="display: -moz-stack;margin: 30px 0px 0px; font-size: 12px; color: rgb(62, 133, 233);" id="add_btn">+添加筛选条件</a>
                                                                                                            </div>-->
                                                                                                            <div class="" style="margin-left: 20px;margin-top: 10px;">
                                                                                                                <div  class="form-group">
                                                                                                                    <div class="col-md-3 control-label">所属行业：</div>
                                                                                                                    <div class="col-md-7">
                                                                                                                        <input data-selector="industrys" class="text" type="text" placeholder="请选择行业" id="industrys" name="industry" data-ui="LocalDataUID" style="display: none;width:325px;height:40px;" rell="行业" value="{:I('industry')}" />
                                                                                                                    </div>
                                                                                                                </div>
                                                                                                                <div  class="form-group" style="margin-top: 10px;">
                                                                                                                    <div class="col-md-3 control-label">所属城市：</div>
                                                                                                                    <div class="col-md-7">
                                                                                                                        <input data-selector="dqs" data-option="1" class="text" type="text" placeholder="选择所属城市" id="dqs" name="address" data-ui="LocalDataUIB" style="display: none;width:440px;height:40px;border: 1px solid #d8e3ef;" value="{:I('address')}">
                                                                                                                    </div>
                                                                                                                </div>
                                                                                                            </div>
                                                                                                        </form>
                                                                                                    </div>
                                                                                                    <div style="display:none" id="dialog-addbusiness" title="添加商机">
                                                                                                        <div class="spiner-example">
                                                                                                            <div class="sk-spinner sk-spinner-three-bounce">
                                                                                                                <div class="sk-bounce1"></div>
                                                                                                                <div class="sk-bounce2"></div>
                                                                                                                <div class="sk-bounce3"></div>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    <div style="display:none" id="dialog-excelexport" title="导出客户">
                                                                                                        <div class="spiner-example">
                                                                                                            <div class="sk-spinner sk-spinner-three-bounce">
                                                                                                                <div class="sk-bounce1"></div>
                                                                                                                <div class="sk-bounce2"></div>
                                                                                                                <div class="sk-bounce3"></div>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    <div style="display:none" id="dialog-share" title="分享客户">
                                                                                                        <div class="spiner-example">
                                                                                                            <div class="sk-spinner sk-spinner-three-bounce">
                                                                                                                <div class="sk-bounce1"></div>
                                                                                                                <div class="sk-bounce2"></div>
                                                                                                                <div class="sk-bounce3"></div>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    <div style="display:none" id="dialog-addproduct" title="新增项目">
                                                                                                        <div class="spiner-example">
                                                                                                            <div class="sk-spinner sk-spinner-three-bounce">
                                                                                                                <div class="sk-bounce1"></div>
                                                                                                                <div class="sk-bounce2"></div>
                                                                                                                <div class="sk-bounce3"></div>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    <div style="display:none" id="dialog-product_view" title="产品详情">
                                                                                                        <div class="spiner-example">
                                                                                                            <div class="sk-spinner sk-spinner-three-bounce">
                                                                                                                <div class="sk-bounce1"></div>
                                                                                                                <div class="sk-bounce2"></div>
                                                                                                                <div class="sk-bounce3"></div>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    <div style="display:none;" id="dialog-add_scene" title="新建场景">
                                                                                                        <div class="spiner-example">
                                                                                                            <div class="sk-spinner sk-spinner-three-bounce">
                                                                                                                <div class="sk-bounce1"></div>
                                                                                                                <div class="sk-bounce2"></div>
                                                                                                                <div class="sk-bounce3"></div>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    <div style="display:none;" id="dialog-setting_scene" title="场景管理">
                                                                                                        <div class="spiner-example">
                                                                                                            <div class="sk-spinner sk-spinner-three-bounce">
                                                                                                                <div class="sk-bounce1"></div>
                                                                                                                <div class="sk-bounce2"></div>
                                                                                                                <div class="sk-bounce3"></div>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>

                                                                                                    <div class="modal inmodal fade" id="call_list" aria-hidden="true" aria-labelledby="call_list" role="dialog" tabindex="-1" style="overflow:auto; border:1px solid #000000;">
                                                                                                        <div class="modal-dialog">
                                                                                                            <div class="modal-content" id="call_modal">
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>

                                                                                                    <script type="text/javascript">
                                                                                                        //呼出电话
                                                                                                        $(document).on('click', '.tel_list', function () {
                                                                                                            var model_id = $(this).attr('rel');
                                                                                                            var html = $('#tel_list_' + model_id).prop('outerHTML');
                                                                                                            $('#call_list').modal('show');
                                                                                                            $('#call_modal').html('');
                                                                                                            $('#call_modal').append(html);
                                                                                                        });

                                                                                                        //号码呼出_guo_02/22
                                                                                                        $(document).ready(function () {
                                                                                                            $(".call_out").on('click',function () {
                                                                                                                var itemId = $(this).attr('rel');
                                                                                                                $.post(
                                                                                                                    "{:U('callcenter/call_out')}",
                                                                                                                    {itemId: itemId,type:2,tel:''},
                                                                                                                    function (data) {
                                                                                                                        var obj = $.parseJSON(data);
                                                                                                                        if(obj.code){
                                                                                                                        swal("操作成功！", "拨打电话成功,请稍等电话接通！", "success");
                                                                                    //                                     alert_crm(data.message);
                                                                                                                    }else{
                                                                                                                        alert_crm(obj.msg+",请联系管理员！");
                                                                                                                    }
                                                                                                                    }
                                                                                                                );
                                                                                                            });
                                                                                                        });
                                                                                                        //dropdown menu 不关闭
                                                                                                        $('#dropdown_order').on('click', function (event) {
                                                                                                            event.stopPropagation();
                                                                                                        });
                                                                                                        //客户转移
                                                                                                        $("#change").click(function () {
                                                                                                            var id_array = new Array();
                                                                                                            $("input[class='check_list']:checked").each(function () {
                                                                                                                id_array.push($(this).val());
                                                                                                            });
                                                                                                            if (id_array.length == 0) {
                                                                                                                alert("{:L('YOU_HAVE_NOT_CHOSEN_ANY_CUSTOMERS')}");
                                                                                                            } else {
                                                                                                                var customer_ids = id_array.join(",");
                                                                                                                $('#dialog-transform').dialog('open');
                                                                                                                $('#dialog-transform').load("{:U('customer/transfer_edit')}", "customer_id=" + customer_ids);
                                                                                                            }
                                                                                                        });
                                                                                                        //客户分享
                                                                                                        $("#share").click(function () {
                                                                                                            var id_array = new Array();
                                                                                                            $("input[class='check_list']:checked").each(function () {
                                                                                                                id_array.push($(this).val());
                                                                                                            });
                                                                                                            if (id_array.length == 0) {
                                                                                                                alert("{:L('YOU_HAVE_NOT_CHOSEN_ANY_CUSTOMERS')}");
                                                                                                            } else {
                                                                                                                var customer_ids = id_array.join(",");
                                                                                                                $('#dialog-share').dialog('open');
                                                                                                                $('#dialog-share').load("{:U('customer/share')}", "customer_id=" + customer_ids);
                                                                                                            }
                                                                                                        });
                                                                                                        //取消客户分享
                                                                                                        $("#close_share").click(function () {
                                                                                                            var id_array = new Array();
                                                                                                            $("input[class='check_list']:checked").each(function () {
                                                                                                                id_array.push($(this).val());
                                                                                                            });
                                                                                                            if (id_array.length == 0) {
                                                                                                                alert("{:L('YOU_HAVE_NOT_CHOSEN_ANY_CUSTOMERS')}");
                                                                                                            } else {
                                                                                                                var customer_ids = id_array.join(",");
                                                                                                                swal({
                                                                                                                    title: "您确定要取消客户共享信息吗？",
                                                                                                                    text: "移除后将无法恢复，请谨慎操作！",
                                                                                                                    type: "warning",
                                                                                                                    showCancelButton: true,
                                                                                                                    confirmButtonColor: "#DD6B55",
                                                                                                                    confirmButtonText: "是的，取消！",
                                                                                                                    cancelButtonText: '让我再考虑一下…',
                                                                                                                    closeOnConfirm: false,
                                                                                                                    closeOnCancel: false
                                                                                                                },
                                                                                                                        function (isConfirm) {
                                                                                                                            if (isConfirm) {
                                                                                                                                window.location.href = "{:U('customer/close_share','customer_ids=')}" + customer_ids;
                                                                                                                            } else {
                                                                                                                                swal("已取消", "您取消了此操作！", "error");
                                                                                                                            }
                                                                                                                        });
                                                                                                            }
                                                                                                        });
                                                                                                        $("#dialog-transform").dialog({
                                                                                                            autoOpen: false,
                                                                                                            width: 530,
                                                                                                            maxHeight: 600,
                                                                                                            position: ["center", 100],
                                                                                                            buttons: {
                                                                                                                "确认转移": function () {
                                                                                                                    $('#form_transfer').submit();
                                                                                                                    $(this).dialog("close");
                                                                                                                },
                                                                                                                "取消": function () {
                                                                                                                    $(this).dialog("close");
                                                                                                                }
                                                                                                            },
                                                                                                            close: function () {
                                                                                                                $(this).html('');
                                                                                                            }
                                                                                                        });
                                                                                                        $("#dialog-share").dialog({
                                                                                                            autoOpen: false,
                                                                                                            modal: true,
                                                                                                            width: 720,
                                                                                                            maxHeight: 600,
                                                                                                            position: ["center", 100],
                                                                                                            buttons: {
                                                                                                                "确认分享": function () {
                                                                                                                    $('#share_form').submit();
                                                                                                                    $(this).dialog("close");
                                                                                                                },
                                                                                                                "取消": function () {
                                                                                                                    $(this).dialog("close");
                                                                                                                }
                                                                                                            },
                                                                                                            close: function () {
                                                                                                                $(this).html('');
                                                                                                            }
                                                                                                        });
                                                                                                        //自定义排序
                                                                                                        $('#dropdown_order').on('click', '.save_order', function () {
                                                                                                            var by = "{$_GET['by']}";
                                                                                                            var scene_id = "{$_GET['scene_id']}";
                                                                                                            var order_field = $("input[name='order_field']:checked").val();
                                                                                                            var order_type = $("input[name='order_type']:checked").val();
                                                                                                            var order_parameter = '{$order_parameter}';

                                                                                                            if (order_field != '' && order_type != '') {
                                                                                                                if (order_type == 'cancel_order') {
                                                                                                                    window.location.href = "{:U('customer/index')}" + '&' + order_parameter;
                                                                                                                } else {
                                                                                                                    window.location.href = "{:U('customer/index')}" + '&' + order_parameter + '&order_type=' + order_type + '&order_field=' + order_field;
                                                                                                                }
                                                                                                            }
                                                                                                        });

                                                                                                        /*让复选框默认取消选择*/
                                                                                                        $(':checkbox').prop('checked', false);

                                                                                                        $('[data-toggle="tooltip"]').tooltip({html: true});

                                                                                                        $('#status_id').val("{$Think.get.status_id}");
                                                                                                        $('#status_id').change(function () {
                                                                                                            $('#customer_search').submit();
                                                                                                        });

                                                                                                        /*添加筛选条件*/
                                                                                                        var m = {$max_key};
                                                                                                        $('#add_btn').click(function () {
                                                                                                            m += 1;
                                                                                                                    $('#search_add').append('<div id="con_search_' + m + '" style="float:left;width:650px;padding-top:10px;margin:0px 10px 0 10px;"><div  id="rem_' + m + '" class="pull-left" style="line-height:30px;"><a href="javascript:void(0);" class="rem_search" rel="' + m + '" title="移除"><span class="fa fa-times-circle"></span></a></div>&nbsp;<ul class="nav pull-left" style="margin:0px 0 0 5px;width:620px"><li class="pull-left"><select id="field_' + m + '"  style="width:auto" class="form-control input-sm field_name new-select" onchange="changeCondition(' + m + ')" name=""><option class="" value="name">--{:L('PLEASE_SELECT_A_FILTER_CONDITION')}--</option><volist name="field_list" id="v"><if condition="$v[field] neq 'customer_owner_id'"><option class="{$v['form_type']}" value="{$v[field]}" rel="customer">{$v[name]}</option></if></volist><if condition="$Think.get.content neq 'resource'"><option class="role" value="owner_role_id">{:L('PRINCIPAL')}</option></if><option class="date" value="create_time">{:L('CREATION_TIME')}</option><option class="date" value="update_time">{:L('MODIFICATION_TIME')}</option><option class="text" value="contacts_name">首要联系人姓名</option><option class="mobile" value="contacts_telephone">首要联系人电话</option></select>&nbsp;&nbsp;</li><li class="pull-left" id="conditionContent_' + m + '"><select id="condition_' + m + '" style="width:99px" class="form-control input-sm new-select" name="condition" onchange="changeSearch()"><option value="contains">{:L('INCLUDE')}</option><option value="not_contain">{:L('EXCLUSIVE')}</option><option value="is">{:L('YES')}</option><option value="isnot">{:L('ISNOT')}</option><option value="start_with">{:L('BEGINNING_CHARACTER')}</option><option value="end_with">{:L('TERMINATION_CHARACTER')}</option><option value="is_empty">{:L('Mandatory')}</option><option value="is_not_empty">{:L('ISNOTEMPTY')}</option></select>&nbsp;&nbsp;</li><li class="pull-left" id="searchContent_' + m + '"><input id="search_' + m + '" type="text" style="width:160px;" class="input-medium form-control input-sm search-query" name="value"/>&nbsp;&nbsp;</li></ul></div>');
                                                                                                        });
                                                                                                        $(document).on('click', '.rem_search', function () {
                                                                                                            var num = $(this).attr('rel');
                                                                                                            $('#con_search_' + num).remove();
                                                                                                        });

                                                                                                        // 筛选重复判断
                                                                                                        var dosearch = 1;
                                                                                                        function doh() {
                                                                                                            var ary = new Array();
                                                                                                            var field_name = '';
                                                                                                            var is_submit = 1;
                                                                                                            $('.field_name').each(function (k, v) {
                                                                                                                field_name = $(this).find("option:selected").val();
                                                                                                                if (jQuery.inArray(field_name, ary) >= 0) {
                                                                                                                    is_submit = 0;
                                                                                                                    swal({
                                                                                                                        title: "筛选条件中有重复项！",
                                                                                                                        text: "",
                                                                                                                        type: "error"
                                                                                                                    });
                                                                                                                    dosearch = 0;
                                                                                                                    return false;
                                                                                                                }
                                                                                                                ary[k] = field_name;
                                                                                                            })
                                                                                                            if (is_submit == 1) {
                                                                                                                $("#searchForm").submit();
                                                                                                            }
                                                                                                        }

                                                                                                        var url = "{:U('customer/getcurrentstatus')}";
                                                                                                        var limit_size = 1000;
                                                                                                                var count = {$count | default = 0}
                                                                                                        ;
                                                                                                        var ii = 1;
                                                                                                        function remainTime() {
                                                                                                            var id_array = new Array();
                                                                                                            // 判断是普通查询还是高级搜索
                                                                                                            var field = "{$_GET['field']}";

                                                                                                            $("input.check_list:checked").each(function () {
                                                                                                                id_array.push($(this).val());
                                                                                                            });
                                                                                                            $.get(url, function (data) {
                                                                                                                if (data.data == 0) {
                                                                                                                    if (id_array != '') {
                                                                                                                        count = id_array.length;
                                                                                                                    }
                                                                                                                    if ((ii - 1) * limit_size < count) {
                                                                                                                        $("#act").val('excel');
                                                                                                                        $("#daochu").val(id_array);
                                                                                                                        $("#current_page").val(ii);
                                                                                                                        $("#export_limit").val(limit_size);
                                                                                                                        if (field) {
                                                                                                                            $("#customer_search").submit();
                                                                                                                        } else {
                                                                                                                            $("#searchForm").submit();
                                                                                                                        }
                                                                                                                        setTimeout("remainTime()", 1000);
                                                                                                                        ii++;
                                                                                                                    } else {
                                                                                                                        $("#act").val('');
                                                                                                                        swal("数据导出成功！", "", "success");
                                                                                                                        ii = 1;
                                                                                                                    }

                                                                                                                } else {
                                                                                                                    setTimeout("remainTime()", 1000);
                                                                                                                }
                                                                                                            }, 'json');
                                                                                                        }

                                                                                                        $("#dialog-product_view").dialog({
                                                                                                            autoOpen: false,
                                                                                                            modal: true,
                                                                                                            minWidth: 800,
                                                                                                            maxHeight: 600,
                                                                                                            position: ["center", 100]
                                                                                                        });
                                                                                                        //产品详情
                                                                                                        $(".product_view").click(function () {
                                                                                                            var business_id = $(this).attr('rel');
                                                                                                            var customer_id = $(this).attr('rel1');
                                                                                                            var code = $(this).attr('rel2');
                                                                                                            //判断是否有商机编号，如果没有则提示添加产品
                                                                                                            if (!code) {
                                                                                                                swal({
                                                                                                                    title: "请先添加产品信息",
                                                                                                                    text: "",
                                                                                                                    type: "warning",
                                                                                                                    showCancelButton: true,
                                                                                                                    confirmButtonColor: "#DD6B55",
                                                                                                                    confirmButtonText: "添加产品",
                                                                                                                    closeOnConfirm: true,
                                                                                                                }, function () {
                                                                                                                    // $('#dialog-addbusiness').dialog('open');
                                                                                                                    $('#dialog-addproduct').dialog('open');
                                                                                                                    $('#dialog-addproduct').load('{:U("product/mutildialog_product","customer_id=")}' + customer_id);
                                                                                                                });
                                                                                                            } else {
                                                                                                                $('#dialog-product_view').dialog('open');
                                                                                                                $('#dialog-product_view').load('{:U("business/product_view","id=")}' + business_id);
                                                                                                            }
                                                                                                        });
                                                                                                        /*营销阶段*/
                                                                                                        $("#dialog-advance").dialog({
                                                                                                            autoOpen: false,
                                                                                                            modal: true,
                                                                                                            minWidth: 320,
                                                                                                            maxHeight: 800,
                                                                                                            position: ["center", 100]
                                                                                                        });
                                                                                                        //推进
                                                                                                        $(".advance").click(function () {
                                                                                                            var business_id = $(this).attr('rel');
                                                                                                            var customer_id = $(this).attr('rel1');
                                                                                                            var code = $(this).attr('rel2');
                                                                                                            //判断是否有商机编号，如果没有则提示添加产品
                                                                                                            if (!code) {
                                                                                                                swal({
                                                                                                                    title: "请先添加产品信息",
                                                                                                                    text: "添加产品信息后，才可以推进",
                                                                                                                    type: "warning",
                                                                                                                    showCancelButton: true,
                                                                                                                    confirmButtonColor: "#DD6B55",
                                                                                                                    confirmButtonText: "添加产品",
                                                                                                                    closeOnConfirm: true,
                                                                                                                }, function () {
                                                                                                                    // $('#dialog-addbusiness').dialog('open');
                                                                                                                    $('#dialog-addproduct').dialog('open');
                                                                                                                    $('#dialog-addproduct').load('{:U("product/mutildialog_product","customer_id=")}' + customer_id);
                                                                                                                });
                                                                                                            } else {
                                                                                                                $('#dialog-advance').dialog('open');
                                                                                                                $('#dialog-advance').load('{:U("business/advance","id=")}' + business_id);
                                                                                                            }
                                                                                                        });

                                                                                                        if ("{:C('isMobile')}" == "1") {
                                                                                                            width = $('.container').width() * 0.9;
                                                                                                        } else {
                                                                                                            width = 800;
                                                                                                        }

                                                                                                        $("#dialog-add_scene").dialog({
                                                                                                            autoOpen: false,
                                                                                                            modal: true,
                                                                                                            width: 750,
                                                                                                            height: 500,
                                                                                                            position: ["center", 100],
                                                                                                            buttons: {
                                                                                                                "确定": function () {
                                                                                                                    if ($('#scene_name').val() == '') {
                                                                                                                        alert_crm('请填写场景名称！');
                                                                                                                        return false;
                                                                                                                    }
                                                                                                                    dohDialog();
                                                                                                                    if (dosearchDialog == 1) {
                                                                                                                        var dialog = $('#scene_dialog').val();
                                                                                                                        var temp = '';
                                                                                                                        $.ajax({
                                                                                                                            type: 'post',
                                                                                                                            url: "{:U('system/scene_add')}",
                                                                                                                            data: $("#searchFormDialog").serialize(),
                                                                                                                            async: false,
                                                                                                                            success: function (data) {
                                                                                                                                if (data.status == 1) {
                                                                                                                                    swal("温馨提示！", "创建成功！", "success");
                                                                                                                                    if (dialog == 1) {
                                                                                                                                        temp += '<tr class="controls_tr" id="tr_"+data.data.id>\
                                                                                                                                                                            <td><input type="hidden" class="check_list_scene" name="id[]" value="' + data.data.id + '"/></td>\
                                                                                                                                                                            <td>' + data.data.name + '</td>\
                                                                                                                                                                            <td>\
                                                                                                                                                                                    <div class="radio radio-info radio-inline" style="padding-left:20px;">';
                                                                                                                                        if (data.data.is_default == 1) {
                                                                                                                                            temp += '<input type="radio" class="is_default" name="is_default"  rel="' + data.data.id + '" checked /><label for=""></label>';
                                                                                                                                        } else {
                                                                                                                                            temp += '<input type="radio" class="is_default" name="is_default"  rel="' + data.data.id + '"/><label for=""></label>';
                                                                                                                                        }
                                                                                                                                        temp += '</div>\
                                                                                                                                                                            </td>\
                                                                                                                                                                            <td>';
                                                                                                                                        if (data.data.is_hide == 0) {
                                                                                                                                            temp += '<a class="is_hide" href="javascript:void(0);" rel="' + data.data.id + '" title="不启用" ><span class="fa fa-toggle-on" id="hide_span_' + data.data.id + '" style="color:#ccc;font-size:20px;"></span></a>';
                                                                                                                                        } else {
                                                                                                                                            temp += '<a class="is_hide" href="javascript:void(0);" rel="' + data.data.id + '" title="启用" ><span class="fa fa-toggle-off" id="hide_span_' + data.data.id + '" style="color:#ccc;font-size:20px;"></span></a>';
                                                                                                                                        }
                                                                                                                                        temp += '</td>\
                                                                                                                                                                                    <td>\
                                                                                                                                                                                            <a class="edit_scene" style="float:left;" href="javascript:void(0);" rel="' + data.data.id + '" title="编辑"><i class="fa fa-pencil"></i></a>&nbsp;&nbsp;\
                                                                                                                                                                                            <a class="delete" style="float:left;margin-left:10px;" href="javascript:void(0);" rel="' + data.data.id + '" title="删除"><i class="fa fa-times"></i></a>\
                                                                                                                                                                                    </td>\
                                                                                                                                                                            </tr>';
                                                                                                                                        $('#tab_Test3_scene').append(temp);
                                                                                                                                    } else {
                                                                                                                                        location.reload();
                                                                                                                                    }
                                                                                                                                } else {
                                                                                                                                    swal({
                                                                                                                                        title: "操作失败！",
                                                                                                                                        text: data.info,
                                                                                                                                        type: "error"
                                                                                                                                    })
                                                                                                                                    return false;
                                                                                                                                }
                                                                                                                            },
                                                                                                                            dataType: 'json'
                                                                                                                        });
                                                                                                                        $(this).dialog("close");
                                                                                                                    }
                                                                                                                },
                                                                                                                "取消": function () {
                                                                                                                    $(this).dialog("close");
                                                                                                                }
                                                                                                            },
                                                                                                            close: function () {
                                                                                                                scene_list();
                                                                                                                $(this).html('');
                                                                                                            }
                                                                                                        });

                                                                                                        $("#add_scene").click(function () {
                                                                                                            $('#dialog-add_scene').dialog('open');
                                                                                                            $('#dialog-add_scene').load('{:U("system/scene_add","module=customer")}');
                                                                                                        });

                                                                                                        $("#dialog-setting_scene").dialog({
                                                                                                            autoOpen: false,
                                                                                                            modal: true,
                                                                                                            width: 900,
                                                                                                            height: 500,
                                                                                                            position: ["center", 100],
                                                                                                            buttons: {
                                                                                                                "确定": function () {
                                                                                                                    $(this).dialog("close");
                                                                                                                },
                                                                                                                "取消": function () {
                                                                                                                    $(this).dialog("close");
                                                                                                                }
                                                                                                            },
                                                                                                            close: function () {
                                                                                                                scene_list();
                                                                                                                $(this).html('');
                                                                                                            }
                                                                                                        });

                                                                                                        $("#setting_scene").click(function () {
                                                                                                            $('#dialog-setting_scene').dialog('open');
                                                                                                            $('#dialog-setting_scene').load('{:U("system/scene_setting","module=customer")}');
                                                                                                        });

                                                                                                        //场景刷新
                                                                                                        function scene_list() {
                                                                                                            var scene_temp = '';
                                                                                                            var url = '';
                                                                                                            $.ajax({
                                                                                                                type: 'post',
                                                                                                                url: "{:U('system/sceneListAjax')}",
                                                                                                                data: {module: 'customer'},
                                                                                                                async: false,
                                                                                                                success: function (data) {
                                                                                                                    if (data.status == 1) {
                                                                                                                        $(data.data).each(function (k, v) {
                                                                                                                            if (v.type == 1) {
                                                                                                                                url = "{:U('customer/index','by=')}" + v.by;
                                                                                                                                scene_temp += '<a href="' + url + '" style="width:100%;color:#676a6c;padding:5px !important;float:left;">\
                                                                                                                                                            <div style="padding:0 10px;">\
                                                                                                                                                            <span class="pull-left" style="line-height:26px;">&nbsp;&nbsp;' + v.name + '</span>\
                                                                                                                                                        </div>\
                                                                                                                                                    </a>';
                                                                                                                            } else {
                                                                                                                                url = "{:U('customer/index','scene_id=')}" + v.id;
                                                                                                                                scene_temp += '<a href="' + url + '" style="width:100%;color:#676a6c;padding:5px !important;float:left;">\
                                                                                                                                                            <div style="padding:0 10px;">\
                                                                                                                                                            <span class="pull-left" style="line-height:26px;">&nbsp;&nbsp;' + v.name + '</span>\
                                                                                                                                                        </div>\
                                                                                                                                                    </a>';
                                                                                                                            }
                                                                                                                        });
                                                                                                                        $('#scene_list').html(scene_temp);
                                                                                                                    }
                                                                                                                },
                                                                                                                dataType: 'json'
                                                                                                            });
                                                                                                        }

                                                                                                        $("#dialog-map").dialog({
                                                                                                            autoOpen: false,
                                                                                                            modal: true,
                                                                                                            width: 800,
                                                                                                            minHeight: 600,
                                                                                                            position: ["center", 100]
                                                                                                        });

                                                                                                        $(".getMap").click(function () {
                                                                                                            var map = $(this).attr('rel');
                                                                                                            $('#dialog-map').dialog('open');
                                                                                                            $('#dialog-map').load('{:U("setting/mapdialog","map=")}' + map);
                                                                                                        });

                                                                                                        $("#log_customer").click(function () {
                                                                                                            $('#dialog-log').dialog('open');
                                                                                                            $('#dialog-log').load('{:U("log/add","r=RCustomerLog&module=customer&id=")}' + $(this).attr('rel'));
                                                                                                        });

                                                                                                        $('#form1').on('click', '.log_customer', function () {
                                                                                                            $('#dialog-log').dialog('open');
                                                                                                            $('#dialog-log').load('{:U("log/add","r=RCustomerLog&module=customer&id=")}' + $(this).attr('rel'));
                                                                                                        });

                                                                                                        $("#dialog-log").dialog({
                                                                                                            autoOpen: false,
                                                                                                            modal: true,
                                                                                                            width: 750,
                                                                                                            maxHeight: 500,
                                                                                                            position: ["center", 100],
                                                                                                            buttons: {
                                                                                                                "确定": function () {
                                                                                                                    var log_content = $('#log_content').val();
                                                                                                                    if (log_content == "") {
                                                                                                                        alert_crm("请填写沟通记录！");
                                                                                                                        $("#log_content").focus();
                                                                                                                        return false;
                                                                                                                    }
                                                                                                                    var status_id = $('#status_id option:selected').val();
                                                                                                                    if ($('#save_reply').is(':checked') && status_id == '') {
                                                                                                                        alert_crm("请选择跟进类型！");
                                                                                                                        $("#status_id").focus();
                                                                                                                        return false;
                                                                                                                    }
                                                                                                                    $.ajax({
                                                                                                                        type: 'post',
                                                                                                                        url: "{:U('Log/add')}",
                                                                                                                        data: $('#dialog_form1').serialize(),
                                                                                                                        async: false,
                                                                                                                        success: function (data) {
                                                                                                                            if (data.status == 1) {
                                                                                                                                swal("操作成功！", "沟通日志添加成功！", "success");
                                                                                                                                $("#dialog-log").dialog("close");
                                                                                                                                // location.reload();
                                                                                                                            } else {
                                                                                                                                swal({
                                                                                                                                    title: "操作失败！",
                                                                                                                                    text: data.info,
                                                                                                                                    type: "error"
                                                                                                                                });
                                                                                                                                return false;
                                                                                                                            }
                                                                                                                        },
                                                                                                                        dataType: 'json'
                                                                                                                    });
                                                                                                                },
                                                                                                                "取消": function () {
                                                                                                                    $(this).dialog("close");
                                                                                                                }
                                                                                                            },
                                                                                                            close: function () {
                                                                                                                $(this).html('');
                                                                                                            }
                                                                                                        });

                                                                                                        $("#dialog-role-info").dialog({
                                                                                                            autoOpen: false,
                                                                                                            modal: true,
                                                                                                            width: width,
                                                                                                            maxHeight: 550,
                                                                                                            position: ["center", 100]
                                                                                                        });

                                                                                                        $("#dialog-import").dialog({
                                                                                                            autoOpen: false,
                                                                                                            modal: true,
                                                                                                            width: width,
                                                                                                            maxHeight: 400,
                                                                                                            position: ["center", 100]
                                                                                                        });

                                                                                                        $("#dialog-field-search").dialog({
                                                                                                            autoOpen: false,
                                                                                                            modal: true,
                                                                                                            width: 700,
                                                                                                            minHeight: 350,
                                                                                                            maxHeight: 450,
                                                                                                            position: ["center", 100],
                                                                                                            buttons: {
                                                                                                                "确定": function () {
                                                                                                                    doh();
                                                                                                                    if (dosearch == 1) {
                                                                                                                        $(this).dialog("close");
                                                                                                                    }
                                                                                                                },
                                                                                                                "取消": function () {
                                                                                                                    $(this).dialog("close");
                                                                                                                }
                                                                                                            }
                                                                                                        });

                                                                                                        $("#dialog-fenpei").dialog({
                                                                                                            autoOpen: false,
                                                                                                            modal: true,
                                                                                                            width: width,
                                                                                                            maxHeight: 400,
                                                                                                            position: ["center", 100],
                                                                                                            buttons: {
                                                                                                                "确定": function () {
                                                                                                                    $('#fenpei_form').submit();
                                                                                                                    $(this).dialog("close");
                                                                                                                },
                                                                                                                "取消": function () {
                                                                                                                    $(this).dialog("close");
                                                                                                                }
                                                                                                            },
                                                                                                            close: function () {
                                                                                                                $(this).html('');
                                                                                                            }
                                                                                                        });

                                                                                                        $("#dialog-remind").dialog({
                                                                                                            autoOpen: false,
                                                                                                            modal: true,
                                                                                                            width: width,
                                                                                                            maxHeight: 400,
                                                                                                            position: ["center", 100],
                                                                                                            buttons: {
                                                                                                                "确定": function () {
                                                                                                                    if ($('#dialog_content').val() == '') {
                                                                                                                        alert_crm("请填写提醒内容！");
                                                                                                                        $("#dialog_content").focus();
                                                                                                                    } else {
                                                                                                                        $('#remind_form').submit();
                                                                                                                        $(this).dialog("close");
                                                                                                                    }
                                                                                                                },
                                                                                                                "取消": function () {
                                                                                                                    $(this).dialog("close");
                                                                                                                }
                                                                                                            },
                                                                                                            close: function () {
                                                                                                                $(this).html('');
                                                                                                            }
                                                                                                        });

                                                                                                        $("#dialog-remind_view").dialog({
                                                                                                            autoOpen: false,
                                                                                                            modal: true,
                                                                                                            width: width,
                                                                                                            maxHeight: 400,
                                                                                                            position: ["center", 100],
                                                                                                            buttons: {
                                                                                                                "删除": function () {
                                                                                                                    swal({
                                                                                                                        title: "您确认删除吗？",
                                                                                                                        type: "warning",
                                                                                                                        showCancelButton: true,
                                                                                                                        confirmButtonColor: "#DD6B55",
                                                                                                                        confirmButtonText: "确定",
                                                                                                                        closeOnConfirm: false
                                                                                                                    },
                                                                                                                            function () {
                                                                                                                                var dislog_module_id = $('#dislog_module_id').val();
                                                                                                                                var dislog_module = $('#dislog_module').val();
                                                                                                                                $.ajax({
                                                                                                                                    type: 'post',
                                                                                                                                    url: "{:U('remind/delete')}",
                                                                                                                                    data: {module_id: dislog_module_id, module: dislog_module},
                                                                                                                                    async: false,
                                                                                                                                    success: function (data) {
                                                                                                                                        if (data.status == 1) {
                                                                                                                                            $('#remind_view_' + dislog_module_id).addClass('hide');
                                                                                                                                            swal("操作成功！", "提醒删除成功！", "success");
                                                                                                                                            $("#dialog-remind_view").dialog("close");
                                                                                                                                        } else {
                                                                                                                                            swal({
                                                                                                                                                title: "操作失败！",
                                                                                                                                                text: data.info,
                                                                                                                                                type: "error"
                                                                                                                                            })
                                                                                                                                            return false;
                                                                                                                                        }
                                                                                                                                    },
                                                                                                                                    dataType: 'json'
                                                                                                                                });
                                                                                                                                // $("#dialog_remind").submit();
                                                                                                                                // $(this).dialog("close");
                                                                                                                            });
                                                                                                                },
                                                                                                                "取消": function () {
                                                                                                                    $(this).dialog("close");
                                                                                                                }
                                                                                                            },
                                                                                                            close: function () {
                                                                                                                $(this).html('');
                                                                                                            }
                                                                                                        });

                                                                                                        $("#dialog-assign").dialog({
                                                                                                            autoOpen: false,
                                                                                                            modal: true,
                                                                                                            width: width,
                                                                                                            maxHeight: 400,
                                                                                                            position: ["center", 100],
                                                                                                            buttons: {
                                                                                                                "确定": function () {
                                                                                                                    var owner_role_id = $('input[name="owner_role_id"]').val();
                                                                                                                    var message_alert = $('input:checkbox[name="message_alert"]:checked').val();
                                                                                                                    var sms_alert = $('input:checkbox[name="sms_alert"]:checked').val();
                                                                                                                    var email_alert = $('input:checkbox[name="email_alert"]:checked').val();

                                                                                                                    $("#hidden_owner_id").val(owner_role_id);
                                                                                                                    $("#hidden_message").val(message_alert);
                                                                                                                    $("#hidden_sms").val(sms_alert);
                                                                                                                    $("#hidden_email").val(email_alert);

                                                                                                                    $("#form1").attr('action', '{:U("customer/receive")}');
                                                                                                                    $('#operating_type').val('assign');
                                                                                                                    $("#form1").submit();
                                                                                                                    $(this).dialog("close");
                                                                                                                },
                                                                                                                "取消": function () {
                                                                                                                    $(this).dialog("close");
                                                                                                                }
                                                                                                            },
                                                                                                            close: function () {
                                                                                                                $(this).html('');
                                                                                                            }
                                                                                                        });

                                                                                                        $("#dialog-addbusiness").dialog({
                                                                                                            autoOpen: false,
                                                                                                            modal: true,
                                                                                                            minWidth: 850,
                                                                                                            maxHeight: 400,
                                                                                                            position: ["center", 100],
                                                                                                            buttons: {
                                                                                                                "确定": function () {
                                                                                                                    if (typeof ($('.bus_product').val()) == 'undefined' || $('.bus_product').val() == '0') {
                                                                                                                        alert_crm("请至少选择一个产品！");
                                                                                                                    } else {
                                                                                                                        $('#addbusiness_form').submit();
                                                                                                                        $(this).dialog("close");
                                                                                                                    }
                                                                                                                },
                                                                                                                "取消": function () {
                                                                                                                    $(this).dialog("close");
                                                                                                                }
                                                                                                            },
                                                                                                            close: function () {
                                                                                                                $(this).html('');
                                                                                                            }
                                                                                                        });

                                                                                                        $(".addproduct").click(function () {
                                                                                                            var customer_id = $(this).attr('rel');
                                                                                                            $('#dialog-addproduct').load('{:U("product/mutildialog_product","customer_id=")}' + customer_id);
                                                                                                            $('#dialog-addproduct').dialog('open');
                                                                                                        });

                                                                                                        // 选择产品
                                                                                                        $("#dialog-addproduct").dialog({
                                                                                                            autoOpen: false,
                                                                                                            modal: true,
                                                                                                            minWidth: 850,
                                                                                                            maxHeight: 600,
                                                                                                            position: ["center", 100],
                                                                                                            buttons: {
                                                                                                                "确定": function () {
                                                                                                                    var is_product = $('.cproduct_id').val();
                                                                                                                    if (is_product == 'undefined' || is_product == '0') {
                                                                                                                        alert_crm('请至少选择一个产品！');
                                                                                                                    } else {
                                                                                                                        $('#addbusiness_form').submit();
                                                                                                                        $(this).dialog("close");
                                                                                                                    }
                                                                                                                },
                                                                                                                "取消": function () {
                                                                                                                    $(this).html('');
                                                                                                                    $(this).dialog("close");
                                                                                                                }
                                                                                                            },
                                                                                                            close: function () {
                                                                                                                $(this).empty();
                                                                                                            }
                                                                                                        });

                                                                                                        $("#dialog-excelexport").dialog({
                                                                                                            autoOpen: false,
                                                                                                            modal: true,
                                                                                                            minWidth: 550,
                                                                                                            maxHeight: 400,
                                                                                                            position: ["center", 100],
                                                                                                            buttons: {
                                                                                                                "确定": function () {
                                                                                                                    var select_array = new Array();
                                                                                                                    $("input.select_list:checked").each(function () {
                                                                                                                        select_array.push($(this).val());
                                                                                                                    });
                                                                                                                    $('#selectexcelxport').val(select_array);
                                                                                                                    remainTime();
                                                                                                                    $(this).dialog("close");
                                                                                                                },
                                                                                                                "取消": function () {
                                                                                                                    $(this).dialog("close");
                                                                                                                }
                                                                                                            },
                                                                                                            close: function () {
                                                                                                                $(this).empty();
                                                                                                            }
                                                                                                        });

                                                                                                        $(".addBusiness").click(function () {
                                                                                                            var customer_id = $(this).attr('rel');
                                                                                                            $('#dialog-addbusiness').dialog('open');
                                                                                                            $('#dialog-addbusiness').load('{:U("product/mutildialog_business","customer_id=")}' + customer_id);
                                                                                                        });

                                                                                                        function changeContent() {
                                                                                                            a = $("#select1 option:selected").val();
                                                                                                            window.location.href = "{:U('customer/index', 'by=')}" + a;
                                                                                                        }

                                                                                                        $(function () {
                                                                                                            $("#edit_customer").click(function () {
                                                                                                                window.location.href = "{:U('customer/edit', '&p='.$this_page.'&id=')}" + $(this).attr('rel');
                                                                                                            })
                                                                                                            $(".excelExport").click(function () {
                                                                                                                $('#dialog-excelexport').dialog('open');
                                                                                                                $('#dialog-excelexport').load('{:U("customer/selectexcelexport")}');
                                                                                                            })

                                                                                                            $('#delete').click(function(){
                                                                                                            var id_array = new Array();
                                                                                                                    $("input.check_list:checked").each(function(){
                                                                                                            id_array.push($(this).val());
                                                                                                            });
                                                                                                                    if (id_array.length == 0){
                                                                                                            alert_crm('{:L('YOU_HAVE_NOT_CHOSEN_ANY_CUSTOMERS')}');
                                                                                                                    return false;
                                                                                                            }
                                                                                                            swal({
                                                                                                            title: "您确定要删除客户信息吗？",
                                                                                                                    text: "删除后将无法恢复，请谨慎操作！",
                                                                                                                    type: "warning",
                                                                                                                    showCancelButton: true,
                                                                                                                    confirmButtonColor: "#DD6B55",
                                                                                                                    confirmButtonText: "是的，我要删除！",
                                                                                                                    cancelButtonText:'让我再考虑一下…',
                                                                                                                    closeOnConfirm:false,
                                                                                                                    closeOnCancel:false
                                                                                                            },
                                                                                                                    function(isConfirm){
                                                                                                                    if (isConfirm) {
                                                                                                                    $.ajax({
                                                                                                                    type:'post',
                                                                                                                            url: "{:U('customer/delete')}",
                                                                                                                            data: {customer_id: id_array},
                                                                                                                            async: false,
                                                                                                                            success: function (data) {
                                                                                                                            if (data.status == 1) {
                                                                                                                            swal("删除成功！", "您已经永久删除了信息！", "success");
                                                                                                                                    location.reload();
                                                                                                                            } else {
                                                                                                                            swal({
                                                                                                                            title: "操作失败！",
                                                                                                                                    text:data.info,
                                                                                                                                    type: "error"
                                                                                                                            })
                                                                                                                                    return false;
                                                                                                                            }
                                                                                                                            },
                                                                                                                            dataType: 'json'
                                                                                                                    });
                                                                                                                    } else {
                                                                                                                    swal("已取消", "您取消了删除操作！", "error");
                                                                                                                    }
                                                                                                                    });
                                                                                                            });
                                                                                                                    $('#remove').click(function(){
                                                                                                            swal({
                                                                                                            title: "{:L('CONFIRMED_IN_THE_CUSTOMER_POOL')}",
                                                                                                                    type: "warning",
                                                                                                                    showCancelButton: true,
                                                                                                                    confirmButtonColor: "#DD6B55",
                                                                                                                    confirmButtonText: "确定",
                                                                                                                    closeOnConfirm: false
                                                                                                            },
                                                                                                                    function(){
                                                                                                                    $("#form1").attr('action', '{:U("customer/remove")}');
                                                                                                                            $('#operating_type').attr('value', 'remove');
                                                                                                                            $("#form1").submit();
                                                                                                                    });
                                                                                                            });
                                                                                                                    $("#import_excel").click(function(){
                                                                                                            $('#dialog-import').dialog('open');
                                                                                                                    $('#dialog-import').load('{:U("customer/excelimport")}');
                                                                                                            });
                                                                                                                    $(".role_info").click(function(){
                                                                                                            $role_id = $(this).attr('rel');
                                                                                                                    $('#dialog-role-info').dialog('open');
                                                                                                                    $('#dialog-role-info').load('{:U("user/dialoginfo","id=")}' + $role_id);
                                                                                                            });
                                                                                                                    $("#check_send").click(function(){
                                                                                                            var id_array = new Array();
                                                                                                                    $("input.check_list:checked").each(function(){
                                                                                                            id_array.push($(this).val());
                                                                                                            });
                                                                                                                    if (id_array.length == 0){
                                                                                                            alert('{:L('YOU_HAVE_NOT_CHOSEN_ANY_CUSTOMERS')}');
                                                                                                            } else{
                                                                                                            var customer_ids = id_array.join(",");
                                                                                                                    window.open("{:U('setting/sendSms', 'model=customer&customer_ids=')}" + customer_ids);
                                                                                                            }
                                                                                                            }
                                                                                                            );

                                                                                                            $("#check_send_email").click(function () {
                                                                                                                var id_array = new Array();
                                                                                                                $("input.check_list:checked").each(function () {
                                                                                                                    id_array.push($(this).val());
                                                                                                                });

                                                                                                                if (id_array.length == 0) {
                                                                                                                    swal("{:L('YOU_HAVE_NOT_CHOSEN_ANY_CUSTOMERS')}");
                                                                                                                } else {
                                                                                                                    var customer_ids = id_array.join(",");
                                                                                                                    window.open("{:U('setting/sendemail', 'model=customer&customer_ids=')}" + customer_ids);
                                                                                                                }
                                                                                                            });

                                                                                                            $("#page_send").click(function () {
                                                                                                                var id_array = new Array();
                                                                                                                $("input[class='check_list']").each(function () {
                                                                                                                    id_array.push($(this).val());
                                                                                                                });
                                                                                                                if (id_array.length == 0) {
                                                                                                                    swal("{:L('YOU_HAVE_NOT_CHOSEN_ANY_CUSTOMERS')}");
                                                                                                                } else {
                                                                                                                    var customer_ids = id_array.join(",");
                                                                                                                    window.open("{:U('setting/sendSms', 'model=customer&customer_ids=')}" + customer_ids);
                                                                                                                }
                                                                                                            });

                                                                                                            $("#page_send_email").click(function () {
                                                                                                                var id_array = new Array();
                                                                                                                $("input[class='check_list']").each(function () {
                                                                                                                    id_array.push($(this).val());
                                                                                                                });
                                                                                                                if (id_array.length == 0) {
                                                                                                                    swal("{:L('YOU_HAVE_NOT_CHOSEN_ANY_CUSTOMERS')}");
                                                                                                                } else {
                                                                                                                    var customer_ids = id_array.join(",");
                                                                                                                    window.open("{:U('setting/sendemail', 'model=customer&customer_ids=')}" + customer_ids);
                                                                                                                }
                                                                                                            });

                                                                                                            $("#transform").click(function () {
                                                                                                                var id_array = new Array();
                                                                                                                $("input.check_list:checked").each(function () {
                                                                                                                    id_array.push($(this).val());
                                                                                                                });
                                                                                                                if (id_array.length == 0) {
                                                                                                                    swal("{:L('YOU_HAVE_NOT_CHOSEN_ANY_CUSTOMERS')}");
                                                                                                                } else {
                                                                                                                    var customer_ids = id_array.join(",");
                                                                                                                    $('#dialog-transform').dialog('open');
                                                                                                                    $('#dialog-transform').load("{:U('customer/transfer_edit')}", "customer_id=" + customer_ids);
                                                                                                                }
                                                                                                            });

                                                                                                            $("#all_send_email").click(function () {
                                                                                                                window.open("{:U('setting/sendemail', 'model=customer&customer_ids=all')}");
                                                                                                            });

                                                                                                            $("#all_send").click(function () {
                                                                                                                $("#act").val('sms');
                                                                                                                $("#searchForm").submit();
                                                                                                            });

                                                                                                            $(".fenpei").click(function () {
                                                                                                                var customer_id = $(this).attr('rel');
                                                                                                                $('#dialog-fenpei').dialog('open');
                                                                                                                $('#dialog-fenpei').load('{:U("customer/fenpei","customer_id=")}' + customer_id);
                                                                                                            });

                                                                                                            $("#remind").click(function () {
                                                                                                                var customer_id = $(this).attr('rel');
                                                                                                                $('#dialog-remind').dialog('open');
                                                                                                                $('#dialog-remind').load("{:U('remind/add','module=customer&module_id=')}" + customer_id);
                                                                                                            });

                                                                                                            $(".remind_view").click(function () {
                                                                                                                var customer_id = $(this).attr('rel');
                                                                                                                $('#dialog-remind_view').dialog('open');
                                                                                                                $('#dialog-remind_view').load("{:U('remind/view','module=customer&module_id=')}" + customer_id);
                                                                                                            });

                                                                                                            $("#to_top").click(function () {
                                                                                                                var customer_id = $(this).attr('rel');
                                                                                                                $("#form1").attr('action', '{:U("customer/settop","module=customer&module_id=")}' + customer_id);
                                                                                                                $("#form1").submit();
                                                                                                            });
                                                                                                            $('#batch_assign').click(function () {
                                                                                                                $('#dialog-assign').dialog('open');
                                                                                                                $('#dialog-assign').load('{:U("customer/fenpei")}');
                                                                                                            });

                                                                                                            $('#batch_receive').click(function () {
                                                                                                                swal({
                                                                                                                    title: "{:L('SURE_YOU_WANT_TO_BATCH_TO_RECEIVE')}",
                                                                                                                    type: "warning", showCancelButton: true,
                                                                                                                    confirmButtonColor: "#DD6B55",
                                                                                                                    confirmButtonText: "确定",
                                                                                                                    closeOnConfirm: false
                                                                                                                }, function () {
                                                                                                                    $("#form1").attr('action', '{:U("customer/receive")}');
                                                                                                                    $('#operating_type').attr('value', 'receive');
                                                                                                                    $("#form1").submit();
                                                                                                                });
                                                                                                            });

                                                                                                            $("#search_type").click(function () {
                                                                                                                $("#dialog-field-search").dialog('open');
                                                                                                            });
                                                                                                        });

                                                                                                        //编辑客户状态效果
                                                                                                        $(function () {
                                                                                                            //点击效果
                                                                                                            $(".editstatus").click(function () {
                                                                                                                $(".status_ico").hide();
                                                                                                                $(this).next().show();
                                                                                                            })
                                                                                                            //点击确认按钮修改状态
                                                                                                            $(".status_btnedit").click(function () {
                                                                                                                var customer_id = parseInt($(this).closest("tr").attr("rel"));
                                                                                                                var customer_status = $(this).closest(".editable-controls").find("select option:selected").val();
                                                                                                                $.ajax({
                                                                                                                    type: "post",
                                                                                                                    url: "/index.php?m=customer&a=edit&id=" + customer_id,

                                                                                                                    data: {
                                                                                                                        customer_status: customer_status
                                                                                                                    },
                                                                                                                    success: function (data) {
                                                                                                                        swal("温馨提示！", "状态修改成功！", "success");
                                                                                                                        window.location = location;
                                                                                                                    },
                                                                                                                    error: function () {

                                                                                                                    }
                                                                                                                })
                                                                                                            })
                                                                                                        })

                                                                                                        $(document).click(function (e) {
                                                                                                            var _con = $('.editstatus,.editable-controls select');   // 设置目标区域
                                                                                                            if (!_con.is(e.target) && _con.has(e.target).length === 0) {
                                                                                                                $(".status_ico").hide();
                                                                                                            }
                                                                                                            ;
                                                                                                        });
                                                                                                    </script>


                                                                                                    <script type="text/javascript">

                                                                                                        //鼠标点击空白处，隐藏右侧滑出
                                                                                                        document.onmousedown = function (event) {
                                                                                                            if (event.target.className == 'right-sidebar-toggle-log')
                                                                                                                return;

                                                                                                            var div = document.getElementById("right-sidebar-log");
                                                                                                            var x = event.clientX;
                                                                                                            var y = event.clientY;
                                                                                                            var divx1 = div.offsetLeft;
                                                                                                            var divy1 = div.offsetTop;
                                                                                                            var divx2 = div.offsetLeft + div.offsetWidth;
                                                                                                            var divy2 = div.offsetTop + div.offsetHeight;
                                                                                                            if (x < divx1 || x > divx2 || y < divy1 || y > divy2) {
                                                                                                                if ($("#right-sidebar-log").css('right') == '0px') {
                                                                                                                    $("#right-sidebar-log").animate({right: '-60%'}, 400);
                                                                                                                }
                                                                                                            }
                                                                                                        }

                                                                                                        //日志详情弹出
                                                                                                        var timer;
                                                                                                        $(document).on('mouseenter', '.right-sidebar-toggle-log', function () {

                                                                                                            var log_id = $(this).attr('rel');
                                                                                                            clearTimeout(timer);
                                                                                                            timer = setTimeout(function () {

                                                                                                                if ($("#right-sidebar-log").css('right') != '0px') {
                                                                                                                    $("#right-sidebar-log").animate({right: '0px'}, 600);
                                                                                                                }
                                                                                                                $('#sidebar-container').load("/index.php?m=customer&a=view&id=" + log_id);
                                                                                                            }, 1000);
                                                                                                        });

                                                                                                        $(".right-sidebar-toggle-log").on("mouseleave", function () {
                                                                                                            clearTimeout(timer);
                                                                                                        })
                                                                                                    </script>

                                                                                                    <!-- loading加载 -->
                                                                                                    <!-- <style type="text/css">
                                                                                                            #box{
                                                                                                                    position:absolute;
                                                                                                                    top:0;
                                                                                                                    bottom:0;
                                                                                                                    left:0;
                                                                                                                    right:0;
                                                                                                                    background:#000;
                                                                                                                    opacity:0.7;
                                                                                                    
                                                                                                                    padding-top: 200px;
                                                                                                                    padding-left: 45%;
                                                                                                            }
                                                                                                    </style>
                                                                                                    <div id="box" style="display: none;"><img src="__PUBLIC__/img/loading.gif" width="80px"></div>
                                                                                                    <script type="text/javascript">
                                                                                                            //呼叫功能
                                                                                                            $('.call').click(function(){
                                                                                                                    $('#box').show();
                                                                                                    
                                                                                                                    var phone = $(this).attr('phone');
                                                                                                                    var extid = "{$_SESSION['extid']}";
                                                                                                                    var agent_ip = "{:C('AGENT_IP')}";
                                                                                                    
                                                                                                                    if (!phone) {
                                                                                                                            alert('该客户没有联系方式！');
                                                                                                                            $('#box').hide();
                                                                                                                            return false;
                                                                                                                    }
                                                                                                    
                                                                                                                    $.ajax({
                                                                                                                            type:'get',
                                                                                                                            url: "http://"+agent_ip+"/agent/index.php/home/index/call",
                                                                                                                            data: {phone:phone, extid:extid},
                                                                                                                            async:true,
                                                                                                                            success:function(data){
                                                                                                                                    if (data.status == 1) {
                                                                                                                                            $('#box').hide();
                                                                                                                                    } else {
                                                                                                                                            $('#box').hide();
                                                                                                                                            alert(data.info);
                                                                                                                                    }
                                                                                                                            },
                                                                                                                            error:function(){
                                                                                                                                    $('#box').hide();
                                                                                                                                    alert('响应失败，请联系管理员检查呼叫配置！');
                                                                                                                            },
                                                                                                                            dataType:'json'
                                                                                                                    });
                                                                                                            });
                                                                                                    </script> -->

                                                                                                    <include file="Public:footer" />


                                                                                                    <div id="right-sidebar-log">
                                                                                                        <!--the css for jquery.mCustomScrollbar-->
                                                                                                        <link rel="stylesheet" href="__PUBLIC__/emoji/css/jquery.mCustomScrollbar.min.css"/>
                                                                                                        <!--the css for this plugin-->
                                                                                                        <link rel="stylesheet" href="__PUBLIC__/emoji/css/jquery.emoji.css"/>
                                                                                                        <!--(Optional) the js for jquery.mCustomScrollbar's addon-->
                                                                                                        <script src="__PUBLIC__/emoji/js/jquery.mousewheel-3.0.6.min.js"></script>
                                                                                                        <!--the js for jquery.mCustomScrollbar-->
                                                                                                        <script src="__PUBLIC__/emoji/js/jquery.mCustomScrollbar.min.js"></script>
                                                                                                        <!--the js for this plugin-->
                                                                                                        <script src="__PUBLIC__/emoji/js/jquery.emoji.js"></script>

                                                                                                        <div class="sidebar-container" id="sidebar-container">

                                                                                                        </div>
                                                                                                    </div>
                                                                                                    <script src="__PUBLIC__/resume_selector/common.21a64352.js"></script>
                                                                                                    <script src="__PUBLIC__/resume_selector/resume.search.910ebde0.js "></script>